RE: [SLUG] File Renaming

From: Bill Glidden (bglidden@tampabay.rr.com)
Date: Fri Aug 20 2004 - 15:49:11 EDT


If all the directories are in the same directory you could do something
like:

cd yourdir
for i in *
do
    for j in $i/*
    do
        mv $j $i/$i-`basename $j`
    done
done

> -----Original Message-----
> From: slug@nks.net [mailto:slug@nks.net] On Behalf Of Frank Roberts - SOTL
> Sent: Friday, August 20, 2004 2:28 PM
> To: slug@nks.net
> Subject: [SLUG] File Renaming
>
> Hi All
>
> I have approximately 2000 files in approximately 200 directories I would
> like
> to rename.
>
> To me the easies to explain this is by example.
>
> ----------------------
> Currently:
> The first directory's name be XXX-001 with files in the directory are
> named
> 001.jpg to 020.jpg
>
> The second directory's name be XXX-002 with files in the directory are
> named
> 001.jpg to 020.jpg
>
> And so on for 200 directories.
>
> ----------------------
> What I would like to rename the files as:
>
> The first directory's name remain XXX-001 but the file names in the
> directory
> to change to XXX-001-001.jpg to XXX-001-020.jpg
>
> The second directory's name remain XXX-002 but the file names in the
> directory
> to change to XXX-002-001.jpg to XXX-002-020.jpg
>
> And so on for 200 directories.
>
> ----------------------
> Each directory does not have the same number of files in it.
>
> Suggestions on how to do this would be appreciated.
>
> Thanks
> Frank
>
>
> -----------------------------------------------------------------------
> This list is provided as an unmoderated internet service by Networked
> Knowledge Systems (NKS). Views and opinions expressed in messages
> posted are those of the author and do not necessarily reflect the
> official policy or position of NKS or any of its employees.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:04:06 EDT