AppleScript to Make Filenames Unique
by hzimmerman in Circuits > Apple
1678 Views, 6 Favorites, 0 Comments
AppleScript to Make Filenames Unique
I needed this when I import photos from several sources and they have overlapping names. Simply select all the files and execute this script, probably from the User Scripts Folder.
Add the AppleScript Icon to the OSX Menu Bar
Inside the AppleScript editor (in your OSX Applications - Utilities) go to Preferences - General and check
[x] Show Script menu in menu bar
Add This Script to Your User Scripts
# AppleScript (multi) rename script for Finder files.
# Hens Zimmerman, October 16, 2011. # Iterate through all files and rename them. tell application "Finder" set filenames to selection set theCount to number of items in filenames repeat with idx from 1 to theCount set theFile to (item idx of filenames as text) set TheName to name of (theFile as alias) set UUID to do shell script "uuidgen" set NewName to (UUID & " " & TheName) set name of file theFile to NewName end repeat end tell
Now in the OSX Finder, simply select the files you want to give a unique filename and execute the script.