How can I rename multiple pictures simultaneously?

For example,I have 20 pictures downloaded from the Internet. They have some crazy names like "XFGHDHR345" or "SDEREWQ230", and I want to name them:

"Picture 1"
"Picture 2"
"Picture 3"
"Picture 4"
"Picture 5"
.....
"Picture 20"

I don't want to type them one by one. I want to change their names at once.

Is there a way to do this?


Solution 1:

Using the built-in tool "Automator", you can define a workflow to batch rename files.

To do that, you will have to:

  1. Open Automator find it using Spotlight or in /Applications
  2. Create a new Workflow
  3. Type get into the search field enter image description here

  4. Scroll to the bottom of the list of items and drag Get Specified Item from the Files & Folders actions list on the left panel and drop it into the right panel

  5. Click the Add button and find your files
  6. Add the Sort Finder Items action followed by Rename Finder Items
  7. It the "Rename Finder Items" panel, select "Make Sequential" and "Add number to" Picture
  8. Hit the play button and you should be done

Have a look here or here for an example tutorials on your specific renaming task at hand. An excellent overview of what Automator does and how powerful (and simple) it can be as a personal assistant - see the web page http://macosxautomation.com/automator/index.html

Solution 2:

Yes, you can use Terminal:

  1. Move all your pictures to a temporary folder on the Desktop, for example Temp.

  2. Open Applications>Utilities>Terminal.app.

  3. Change directory to Temp:

    cd ~/Desktop/Temp
    

    where ~ is expanded to your home directory (that is, /Users/<yourusername>.)

  4. Run this compound shell command:

    n=1; for file in *; do mv "$file" "Picture $n"; let n++; done
    

    where:

    • for ...; do ...; done loops over your 20 files. file is the variable that holds filenames. See this article for more information.

    • n, initially set to 1 and increased by one in every iteration with let n++, is the integer suffix for the renamed files.

    • mv "$file" "Picture $n" renames the files. $n is the value of variable n.

    The shell command is equivalent to:

    mv SDEREWQ230 "Picture 1"
    mv XFGHDHR345 "Picture 2"
    mv YWUU7738DT "Picture 3"
    (...)
    

For more information on the bash shell see man bash. For more information on shell scripting see this guide at the Apple developer website.

Solution 3:

If you want to zero-pad the numbers or if the files have different extensions:

i=1; for f in *; do mv "$f" Picture\ $(printf %03d $i).${f#*.}; let i++; done

More examples:

# lowercase (Bash 4) and replace spaces with underscores
for f in *; do f2=${f,,}; mv "$f" "${f2// /_}"; done

# number based on modification date
IFS=$'\n'; i=1; for f in $(ls -rt *.jpg); do mv "$f" $(printf %04d $i).jpg; let i++; done

# file-5.jpg to file-005.jpg
for f in *; do b=${f%.*}; x=${f#*.}; mv "$f" "${b%-*}-$(printf %03d ${b#*-}).$x"; done

Solution 4:

If you have Yosemite, it is built into Finder. Just select the files, rightclick and choose "Rename n files". Then change the dropdown to "Filter" and voila! You have batch renaming options!

Solution 5:

If you don't want to use the Terminal or Automator, there are commercial apps with a GUI for doing this. One is A Better Finder Rename, which has a free trial version.