[ale] help with batch file renaming
Jim Seymour
bluejay at speedfactory.net
Sun Aug 3 00:14:39 EDT 2003
On Sun, 3 Aug 2003, Jason Etheridge wrote:
> 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.
>
Thanks Jason. I'll give it a try. I was just looking at another
directory of files to rename when this arrived :-)
--
Jim Seymour
www.wingbarscafe.com
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale
More information about the Ale
mailing list