[ale] help with batch file renaming

Jason Etheridge phasefx at magusaptus.com
Sun Aug 3 00:00:07 EDT 2003


On Saturday, August 2, 2003, at 11:17 PM, Jim Seymour wrote:
> 2003_Billy_Jo_Bob_01.jpg
> 2003_Billy_Jo_Bob_02.jpg
>
> There may be 50 or more files I need to rename at a time.  I have been
> playing with rename to no avail.  Anyone know a bash script or something
> to make my life easier?

 From the UNIX Power Tools book:

	ls -d *.new | sed 's/\(.*\)\.new$/mv & \1.old/' | sh

for mimicking rename *.new *.old in DOS.

I think you could tweak it like so:

ls -d *.jpg |
sed 's/2003_Billy_Bob_\(.*\)\.jpg$/mv & 2003_Bill_Jo_Bob_\1.jpg/' | sh

Instead of piping it to sh, you could redirect it to a file to 
double-check the commands first.

-- Jason

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list