Skip to content

Instantly share code, notes, and snippets.

@judismith
Created June 11, 2013 19:44
Show Gist options
  • Save judismith/5759969 to your computer and use it in GitHub Desktop.
Save judismith/5759969 to your computer and use it in GitHub Desktop.
This script prepends the parent folder name and " - " to all the children folders. It them moves the children folders to the same level as the parent folder.
tell application "Finder"
set thePath to (path to desktop folder as text)
set clientFolders to get name of folders of folder thePath
repeat with theFolder in clientFolders
if the theFolder starts with "_" then exit repeat
set matterFolders to get folders of folder (thePath & theFolder as text)
repeat with aFolder in matterFolders
set clientName to theFolder as text
set the name of aFolder to theFolder & " - " & the name of aFolder
end repeat
set matterFolders to get folders of folder (thePath & theFolder as text)
repeat with aFolder in matterFolders
move aFolder to thePath
end repeat
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment