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:
- Open Automator find it using Spotlight or in /Applications
- Create a new Workflow
Type get into the search field
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
- Click the Add button and find your files
- Add the Sort Finder Items action followed by Rename Finder Items
- It the "Rename Finder Items" panel, select "Make Sequential" and "Add number to" Picture
- 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:
Move all your pictures to a temporary folder on the Desktop, for example
Temp
.Open Applications>Utilities>Terminal.app.
Change directory to
Temp
:cd ~/Desktop/Temp
where
~
is expanded to your home directory (that is,/Users/<yourusername>
.)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 withlet n++
, is the integer suffix for the renamed files.mv "$file" "Picture $n"
renames the files.$n
is the value of variablen
.
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