How to rename multiple files at once?
No need for command line...
- Add all the images to be renamed into a folder.
- Select all files, right click mouse and select "Rename x items"
- Select "Add text" from first drop down menu
- Select "Before name" from the second drop down menu
- Enter "Vacation_" into the text box (without the quotation marks)
- Press Enter.
Try something like this:
for file in Picture*.jpg
do
mv "$file" "vacation-$file"
done
(open terminal and add one line {press Enter} at a time.)
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
brew install rename
rename s/config\./route\.config\./g *
First you need homebrew installed. Then install rename, and the above regex renames all files with "config." to "route.config".
So say files config.a.js, and config.b.js -> route.config.a.js, route.config.b.js.
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.
While not a Terminal solution, I like Forklift for this purpose (and for many others). From their website:
If you want to bulk rename files I built a small script for that.
# Rename Bullk files.
# Renames all the files in PWD with the given extension.
#
# @param extension | jpg
# @param new_name | name
# Usage: rename jpg new_name
function rename() {
echo "———————————————— STARTED ————————————————"
# Counter.
COUNTER=1
# For do loop.
for file in *."$1"; do
mv "$file" "$2-$COUNTER.$1"
COUNTER=$[$COUNTER +1]
done
echo "———————————————— ✔✔✔ RENAMED Every $1 file in the PWD! ✔✔✔︎ ————————————————"
}
Just put it in your .bashrc
or .zshrc
and run Usage: rename jpg new_name
this will rename all jpg files in the PWD to new_name-1.jpg, new_name-2.jpg, etc.
Cheers!
After downloading rename
brew install rename
run following command
rename -n -A Vacation- *
-A : prepend
-n : Only show how the files would be renamed.
If it looks good, run the same command without -n flags.
try this. do not need run command https://tidbits.com/2018/06/28/macos-hidden-treasures-batch-rename-items-in-the-finder/
Hope that helps