[Sussex] Rename a list of files

akaDruid akadruid at gmail.com
Wed May 11 13:05:43 UTC 2005


> Most of the time, Im not really interested in naming each particular image, just that their in one particular folder named after the date-venue where the photo's were captured.
> 
> I can then burn that to a CD.

If all you want to do is combine two sets of files into a single
folder without name conflicts, I can suggest an easy one liner.  I
looked out my notes from the last time I used sed, and I found this
line, which changes all *.plb files in the working directory to *.sql:

for file in *.plb ; do mv $file `echo $file | sed 's/\(.*\.\)plb/\1sql/'` ; done

So you could adapt that to add an extra element to your file names like so:

for file in *.jpg ; do mv $file `echo $file | sed
's/\(.*\.\)jpg/\1foo.jpg/'` ; done

so your *.jpg files would become *.foo.jpg and could be dumped into
the target directory without fear of name conflicts.  Is that what you
are after?

A rapid test of a couple of .jpgs on my FC2 box suggests the above
works OK.  The original underwent more thorough testing :)

> BTW also thanks to akaDruid for your input.

You're welcome.  I was amused to discover you work on the floor below
my fiancee.  She works for Paymaster.




More information about the Sussex mailing list