Introduction: AppleScript to Make Filenames Unique

Picture of 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.

Step 1: Add the AppleScript Icon to the OSX Menu Bar

Picture of 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

Step 2: 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

Step 3:

Now in the OSX Finder, simply select the files you want to give a unique filename and execute the script.

Comments

About This Instructable

411views

5favorites

License:

Bio: Too much television as a kid.
More by hzimmerman:Computing complex circuits with a TI calculatorHow to make your own delicious and healthy breadControlling a relay board with an Arduino Uno
Add instructable to: