Last active
March 12, 2017 14:46
-
-
Save lsfalimis/6677b66fbea061bf5eb5 to your computer and use it in GitHub Desktop.
Copy the paths of Finder files and folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
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 & POSIX path of (e as text) & return | |
end repeat | |
set the clipboard to theList | |
else if (count of sel) is equal to 1 then | |
set the clipboard to POSIX path of (sel as text) | |
else | |
set the clipboard to POSIX path of (target of window 1 as alias) | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment