Skip to content

Instantly share code, notes, and snippets.

@foo9
Last active December 21, 2015 06:59
Show Gist options
  • Select an option

  • Save foo9/6267702 to your computer and use it in GitHub Desktop.

Select an option

Save foo9/6267702 to your computer and use it in GitHub Desktop.
on work_folder(the_path)
tell application "Finder"
set the_files to every file of the_path
repeat with afile in the_files
peel_label(afile) of me
end repeat
set the_folders to every folder of the_path
repeat with afolder in the_folders
peel_label(afolder) of me
work_folder(afolder) of me -- 再帰呼び出し
end repeat
end tell
end work_folder
-- ラベルをはがす
on peel_label(folder_or_file)
set posix_path to POSIX path of (folder_or_file as string)
log (posix_path)
tell application "Finder"
-- ラベルを設定(0: ラベルなし)
set label index of folder_or_file to 0
end tell
end peel_label
on run
try
set chosen_folder to choose folder
work_folder(chosen_folder)
end try
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment