AppleScript to Make Filenames Unique

About: Too much television as a kid.

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: 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.

Be the First to Share


    • CNC Contest

      CNC Contest
    • Make it Move

      Make it Move
    • Teacher Contest

      Teacher Contest