Re: [SLUG] File Renaming

From: Chris Moore (cmoore@washpat.com)
Date: Fri Aug 20 2004 - 16:27:48 EDT


You could use Perl to do this by using 'Find' and 'Copy'.
Find will recursively locate all of the specified files and return the file
path to the variable $_. This will allow you to split the file path and put
it into an array where you will be able to concatinate the directory name
with the file name. Then you can just use the copy command to put the
renamed file back into it's proper directory.
If you need more help using this method let me know and I can write the Perl
script for you with a few more details from you.

Chris Moore
cmoore@washpat.com
----- Original Message -----
From: "Frank Roberts - SOTL" <sotl155360@earthlink.net>
To: <slug@nks.net>
Sent: Friday, August 20, 2004 2:28 PM
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:12 EDT