Skip to content

Instantly share code, notes, and snippets.

@martijnengler
Created July 29, 2019 07:12
Show Gist options
  • Save martijnengler/facf92cdfe7f5707d9f5faed54597c2c to your computer and use it in GitHub Desktop.
Save martijnengler/facf92cdfe7f5707d9f5faed54597c2c to your computer and use it in GitHub Desktop.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Finder"
-- zet hier het pad naar de juiste map
set thePath to POSIX path of "Macintosh HD:private:tmp:x"
--
-- vanaf hier niets veranderen
--
tell application "System Events"
set allFolders to folders of folder thePath whose visible is true
end tell
repeat with j from 1 to the count of allFolders
tell application "System Events"
set allFiles to (files of (item j of allFolders) whose visible is true)
end tell
repeat with i from 1 to the count of allFiles
set thisFile to item i of allFiles
set newName to (get name of container of thisFile as text) & "_" & name of thisFile
set the name of thisFile to newName as string
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment