Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to rename multiple files at once. For example:

Picture1.jpg
Picture2.jpg
Picture3.jpg
Picture4.jpg

into

Vacation-Picture1.jpg
Vacation-Picture2.jpg
Vacation-Picture3.jpg
Vacation-Picture4.jpg

I am quite familiar with the terminal, if there is no app which is quite good in renaming files.

share|improve this question
add comment

4 Answers 4

up vote 5 down vote accepted

Try something like

 for file in Picture*.jpg
 do
    mv $file "vacation-$file"
 done  

What that does is uses the variable file for each entry matching Picture*.jpg. Then it takes the file or folder and moves it to be prefixed with "vacation".

Hope that helps

share|improve this answer
add comment

While not a Terminal solution, I like Forklift for this purpose (and for many others). From their website:

Forklift's Multi-rename feature description

share|improve this answer
    
Yep, for sure there is a terminal based solution. I also found this on mighty google ;) manytricks.com/namemangler –  YeppThat'sMe Sep 19 '12 at 20:18
    
You may as well post NameMangler as an additional answer, since this is basically a recommendation question. :) –  Dan J Sep 19 '12 at 20:24
add comment

I like user933531's answer, but if you'd like a GUI, the A Better Finder Rename app is really good. I got it from the App Store.

share|improve this answer
add comment

If you prefer a more flexible solution and are able to work with regular expressions this little perl script is very helpful:

#!/usr/bin/perl
# rename - Larry's filename fixer
# Usage: rename perlexpr [files]

($op = shift) || die "Usage: rename perlexpr [filenames]\n";

chomp(@ARGV = <STDIN>) unless @ARGV;

for (@ARGV) {
    $was = $_;
    eval $op;
    die $@ if $@;
    rename($was,$_) unless $was eq $_;
}
share|improve this answer
    
Interesting but not clear how it works. Can you give an example or two? –  geotheory Aug 15 '13 at 12:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.