Skip to content

Instantly share code, notes, and snippets.

@nrollr
Last active December 9, 2021 14:33
Show Gist options
  • Save nrollr/7cfa1d6d19ad03d34075 to your computer and use it in GitHub Desktop.
Save nrollr/7cfa1d6d19ad03d34075 to your computer and use it in GitHub Desktop.
Bulk rename files with csv file
-- Store the .csv file in the same directory as the files you wish to rename
-- Replace 'username' in the path with your own (lines 3 & 10)
set csvFile to "/Users/username/Documents/index.csv"
set csvList to paragraphs of (read csvFile)
set {theID, my text item delimiters} to {my text item delimiters, ","}
repeat with csvLines in csvList
set {oldName, newName} to text items of csvLines
tell application "System Events"
set name of file oldName of folder "/Users/username/Documents/" to newName
end tell
end repeat
set my text item delimiters to theID
@daragon727
Copy link

daragon727 commented Mar 2, 2018

screen shot 2018-03-02 at 3 30 56 pm
How can it be set up to identify and use foreign language characters? Thanks for the help! Im getting this error.

@bretlinford
Copy link

Hi, nrollr.

So, this is a csv file with oldName and newName in 2 different columns? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment