Apple - How can I rename multiple pictures simultaneously?

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


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.


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