Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hakuryuu

macrumors 6502
Original poster
Sep 30, 2007
350
6
Lomita, CA
So in windows I can create a file list, save it to a text file, and create a .bat file with rename commands for each file. for example:

Rename 000055-060409232023-CAM1.jpg cal000image0000055.jpg
Rename 000056-060409232020-CAM1.jpg cal000image0000056.jpg
Rename 000057-060409232016-CAM1.jpg cal000image0000057.jpg
Rename 000058-060409232012-CAM1.jpg cal000image0000058.jpg
Rename 000059-060409232008-CAM1.jpg cal000image0000059.jpg
Rename 000060-060409232004-CAM1.jpg cal000image0000060.jpg
Rename 000061-060409232001-CAM1.jpg cal000image0000061.jpg
Rename 000062-060409231957-CAM1.jpg cal000image0000062.jpg
Rename 000063-060409231953-CAM1.jpg cal000image0000063.jpg

So my question is how do I create a file list and then create a way to batch rename in os x? I know the commands, but I don't know of a way to do it on more than one file at a time. I have found a few renaming apps but they all appear to be focused on just iterating up instead of renaming specific files to a new name.
 

sidewinder

macrumors 68020
Dec 10, 2008
2,425
130
Northern California
Just create a text file, call it "rename.sh" for now, with these lines:

mv 000055-060409232023-CAM1.jpg cal000image0000055.jpg
mv 000056-060409232020-CAM1.jpg cal000image0000056.jpg
mv 000057-060409232016-CAM1.jpg cal000image0000057.jpg
mv 000058-060409232012-CAM1.jpg cal000image0000058.jpg
mv 000059-060409232008-CAM1.jpg cal000image0000059.jpg
mv 000060-060409232004-CAM1.jpg cal000image0000060.jpg
mv 000061-060409232001-CAM1.jpg cal000image0000061.jpg
mv 000062-060409231957-CAM1.jpg cal000image0000062.jpg
mv 000063-060409231953-CAM1.jpg cal000image0000063.jpg

Then use the terminal to add the execute bit:

chmod +x rename.sh

To run it from Terminal, type:

./rename.sh

This all assumes the shell script is in the same dir as the files. Adjust accordingly.

S-
 

RandmTask

macrumors newbie
Aug 26, 2009
14
0
Similar query...

Hi

Similar question

If I had a list of filenames in a text file like such (without the extension)

1.1 Welcome
1.2 Introduction
2.1 The Basics
2.2 etc
2.3 etc
...
...
12.14 etc

how would I go about renaming a folder worth of files. The files are currently named 1.1.pdf, 1.2.pdf etc

New to a mac, still finding my way round :D

cheers
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.