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?

  • For those who have Photoshop, it does a really nice job at easily doing just this. Commented Mar 29, 2013 at 14:46

6 Answers 6


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

  • Nice example of Automator - it's clearly intended for this case to clean up photo files. I'll add in the grandfather of Automator resources, Sal Saghoian's macosxautomation.com/automator/index.html
    – bmike
    Commented Mar 29, 2013 at 13:45

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


    • 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.

  • 1
    This is a much better explanation of using the shell to handle file edits than we have over there. Granted, that example is a simple edit - all files with pattern ABC need to be renamed to 123 so this has to be slightly more complex. +2 if I had two votes.
    – bmike
    Commented Mar 29, 2013 at 13:43
  • @Jadav I don't think you're counting keystrokes correctly here. Even if you key around the Finder and hit Enter on each instead of clicking, it's still more efficient to run the script, even if you're only doing 20 pictures.
    – Mattie
    Commented Mar 29, 2013 at 22:53
  • Compared to the Automator solution ! But newer than less that is some impressive programing on your side.
    – Jadav
    Commented Mar 29, 2013 at 22:59

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
  • HOLA @Lauri Ranta, was that English :), or is the computer going up in smoke after doing that to it ?
    – Jadav
    Commented Mar 29, 2013 at 23:01

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!

  • Wow! Hadn't noticed that one yet. Also includes options for adding text, and some fancier formatting actions. Operation is undoable by Finder. Commented Feb 11, 2015 at 14:22
  • Wow! Thank you for this. I can't believe it took only 1.5 seconds to rename about 50 images. Then, @badabamn, that solution was even quicker!!! Thanks to all!
    – JJ Spelman
    Commented Mar 11, 2015 at 23:41

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.

  • +1 for ABFR -- while it does cost $20, it quite easily handles this particular task, where the initial filenames are random, and many other more complex batch renaming tasks besides.
    – calum_b
    Commented Mar 29, 2013 at 17:28
  • I always like to point out the option of using commercial utility apps with a nice GUI because many casual users find that using the Terminal or Automator is too difficult for some tasks. ABFR is an example of a refined product that is very flexible and works well. For many users, spending $20 is a better option than learning the complexities of rarely-used text commands. You can decide which you would rather use.
    – user9290
    Commented Apr 3, 2013 at 13:37

I will recommend here NameChanger application. Its very simple and fast to use. Very good options given there for renaming files with different criteria.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .