Sunday, February 17, 2008

What's in a name?

Renaming a batch of files.

I needed to rename a bunch of images before uploading to flickr. The following worked well enough:

To preview: (Specified by the -n)

rename -n 's/Image/Saturday_/' Image*.jpg
Image000.jpg renamed as Saturday_000.jpg
Image001.jpg renamed as Saturday_001.jpg
Image003.jpg renamed as Saturday_003.jpg


To perform the task, delte the -n. or swap the -n for -v, verbose, which tells you what it's done.

rename 's/Image/Saturday_/' Image*.jpg


Essentially it's:

rename 's/old/new/' SearchFilter


Reference here.

No comments: