Skip to content

Instantly share code, notes, and snippets.

@lsfalimis
Created July 17, 2014 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsfalimis/a6fdd9ca60735d1ee14d to your computer and use it in GitHub Desktop.
Save lsfalimis/a6fdd9ca60735d1ee14d to your computer and use it in GitHub Desktop.
Copy the paths of Finder files and folders (HFS path)
(*
if select multiple items, copy paths of them with one in each line;
if select an item, copy its path;
if none is selected, copy the current folder path.
*)
tell application "Finder"
set sel to the selection
if (count of sel) is greater than 1 then
set theList to ""
repeat with e in sel
set theList to theList & e & return
end repeat
set the clipboard to theList
else if (count of sel) is equal to 1 then
set the clipboard to sel as text
else
set the clipboard to target of window 1 as text
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment