Hot answers tagged

63 votes

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 ...
Finder Guru's user avatar
34 votes

How to rename multiple files at once?

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 ...
Nick's user avatar
  • 449
20 votes
Accepted

Spotlight search to Bluetooth settings hindered by "Bluetooth file exchange"

You can fix this by adding Bluetooth File Exchange to Spotlight's exclusion list. In Finder, open /Applications/Utilities Navigate to the Spotlight Privacy section: For macOS Ventura and newer Go ...
arcdale's user avatar
  • 385
19 votes

Batch replace substring with another in filenames

Unless you need a solution you can use in a script, you can do this directly in Finder. Select the files you want to rename Right click one of them, and choose Rename N Items... (where N is the ...
calum_b's user avatar
  • 5,871
16 votes
Accepted

Renaming documents from within the 'Open' and 'Save As' dialog boxes just like in Windows

Can I do the same thing in macOS? Yes and No. Let me explain. Yes You can do the same thing from within the Open dialogue window of an application, however it is not done by clicking on the ...
Monomeeth's user avatar
  • 64k
12 votes
Accepted

How do I rename an app in MacOS properly?

Renaming the .app package in Finder only changes the name there, it doesn't change the name shown in the menu. To do so edit YOUR.app/Contents/Resources/XY.lproj/InfoPlist.strings (with XY being the ...
nohillside's user avatar
  • 97.1k
11 votes
Accepted

Renaming files/names in bulk, any smarter solution?

export into a CSV (unicode UTF-8 or any other 8bit encoding, not UTF-16): two columns, separated by ; (assuming there is no ; in a file name) open Terminal change to folder containing the files run ...
nohillside's user avatar
  • 97.1k
9 votes
Accepted

Batch replace substring with another in filenames

There are tons of ways to do this, for instance for i in *pngEND*.png; do [[ -e ${i/.pngEND/_} ]] || echo mv "$i" "${i/.pngEND/_}"; done Remove the echo if the output looks sensible.
nohillside's user avatar
  • 97.1k
9 votes
Accepted

How to confirm Finder's rename prompt using the keyboard?

Press Ctrl+F7 to enable all controls for Tab key and use it to switch the active button in application dialogs. This can also be set in System Preferences -> Keyboard -> Shortcuts.
techraf's user avatar
  • 3,918
8 votes
Accepted

Prepend folder names to file name and flatten file structure

Tricky one, especially if you want to keep all the spaces etc. Run the following in the top directory (the one which contains 2013-02 Snow and birds etc): find . -type f -exec sh -c 'for f do x=${f#....
nohillside's user avatar
  • 97.1k
7 votes
Accepted

How to batch rename files via Terminal using the file's date as filename?

for f in *.*; do echo mv "$f" "$(stat -f '%Sm' -t '%Y-%m-%d %H.%M.%S' "$f").${f##*.}" done Or as a one-liner: for f in *.*; do echo mv "$f" "$(stat -f '%Sm' -t '%Y-%m-%d %H.%M.%S' "$f").${f##*.}...
user3439894's user avatar
  • 57.5k
7 votes
Accepted

Renamed /etc folder. I can't login anymore

I would try booting in single user mode (holding the Apple and S keys while rebooting), mount the hard drive (mount -uw /) and then check and rename etc as needed (there should be an alias at the root ...
David Rouse's user avatar
  • 1,549
7 votes
Accepted

Rename file names in directory to creation timestamp with second precision

If all the files are in the same directory, then in Terminal, changed directory, e.g. cd /path/to/directory and then use the following compound command: for f in *.*; do echo mv -n "$f" "${f%.*}-$(...
user3439894's user avatar
  • 57.5k
6 votes

Mac Terminal - Rename Keeping Last 6 Characters

Make a backup of the files first! Then open Terminal (, start a bash shell if you are not using the default shell) and run cd ~/Desktop/Power \ls | while IFS= read f; do echo mv -vn "$f" "${f/*-/}"; ...
nohillside's user avatar
  • 97.1k
6 votes

How to rename multiple files at once?

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 ...
Sean's user avatar
  • 161
6 votes
Accepted

Batch change creation dates based on file names

Bash parameter expansion will work: for f in *; do t="${f#* }" t="${t%%.*}" t="${t:0:4}${t:5:2}${t:8:2}${t:11:2}${t:13:2}.${t:15:2}" touch -t $t "$f" done t="${f#* }" strips off the ...
klanomath's user avatar
  • 65.9k
6 votes

Batch Renaming Folders

Select all the folders you want to rename, right click them and select "Rename [number] Items..." When you use the "Rename Finder Items" feature, you have to change it from "Replace Text" to "Format" ...
airsquared's user avatar
  • 5,007
5 votes

How to find duplicate folder names and resolve naming conflicts in OS X?

You can do this in bash to identify which files and folders are problematic: find /path/to/remote/library | tr A-Z a-z | sort | uniq -d This will output all lower case files and folders that have a ...
madmax1's user avatar
  • 713
5 votes

Renaming files/names in bulk, any smarter solution?

I've found this to be one of the most simple ways: In a spreadsheet column, concatenate: "cp oldfilename newfilename" to create a copy with the new name. Use "mv oldfilename newfilename" to replace ...
Steve's user avatar
  • 51
5 votes

Renaming documents from within the 'Open' and 'Save As' dialog boxes just like in Windows

Right-click or control-click on the file to rename it from the open dialog.
Ɱark Ƭ's user avatar
  • 9,428
5 votes
Accepted

Automator action not supplied with the required data

It is still not totally clear what it is you're trying to accomplish, however, here is an example workflow that you might find useful. First Automator Workflow Broken into two working segments: ...
user3439894's user avatar
  • 57.5k
5 votes
Accepted

Rename home folder to match account name (High Sierra)

Per Apple, assuming you're on OS X 10.7 or higher: Delete the orphaned home directory. Log out of the account you're renaming, then log in to a different administrator account. Go to the Users folder ...
JMY1000's user avatar
  • 5,034
4 votes
Accepted

Batch Renaming Folders

Here is an AppleScript solution that is quite efficient. You can save this code in script editor.app as an application. set newName to 0 set theFolder to (choose folder with prompt "Choose Folder" ...
wch1zpink's user avatar
  • 7,421
4 votes

Renaming files sequentially from folder name with Automator

Using Automator for the Folder Action In the Automator Folder Action image further below in this answer, pay attention to the Automator actions and their settings. In particular, the Options set on ...
user3439894's user avatar
  • 57.5k
3 votes

What is the best way to update the name of a Service?

After renaming the .workflow file in Finder, open the file in Automator and then save the file (press ⌘ command + S). The file must be re-saved in Automator if you want the new name to appear in the ...
rubik's sphere's user avatar
3 votes

Batch change creation dates based on file names

Since you asked how you could tweak what you already had, you'd change the capture groups in the first occurrence of sed to match the new pattern, while leaving the second sed as is. Also double quote ...
user3439894's user avatar
  • 57.5k
3 votes

How to change Logical Volume name

Two approaches: Try using the Volume UUID instead of the name: diskutil rename LVUUID newName So, in your case, issue the command: diskutil rename DF2B66E8-0534-430A-B9F6-5697E4E294B2 OSX Change it ...
Allan's user avatar
  • 97.5k
3 votes

How to batch rename files via Terminal using the file's date as filename?

for f in *.jpg; do echo mv "$f" "$(stat -f '%Sm' -t '%Y-%m-%d %H.%M.%S' "$f")".jpg done Remove the echo once you are sure that the command looks ok.
nohillside's user avatar
  • 97.1k
3 votes

Prepend folder names to file name and flatten file structure

@nohillside 's answer above is great actually. The only issue with it is that it does not account for files with spaces in them. That will cause some of the commands to fail. So I'm putting an answer ...
xemacobra's user avatar
  • 147
3 votes
Accepted

Apple Maps: Renaming Favorites or Marked Locations

To rename favorites in Maps on macOS (source): Click on the magnifying glass in the search field Click Favorites Click "Edit" in the bottom right Click on a Favorite's name to modify it Press return ...
aaplmath's user avatar
  • 3,045

Only top scored, non community-wiki answers of a minimum length are eligible