How can I copy the path to a folder or a file? The Info Dialog doesn't allow me to copy the information that stands there ...
Is there an easy way to do this?
Right click on the file, hold down Alt/Option, and an item to copy file path will appear as Copy "<FILENAME>" as Pathname
.
This is the easiest option for day to day usage, without involving Automator.
This seems to be a relatively new feature that was added in OS X El Capitan. (It also works on macOS Sierra).
Starting in El Capitan (OS X v10.11), this is really easy:
As already described by ayaz, the Get Info window (cmd+i) has the full path and will allow you to copy it. If you tripple click in the highlighted area (by the red rectangle) the selection will automatically expand to the whole path. cmd + c will suffice to copy it to the clipboard.
If you need the path to interact with the Terminal, you can always check one of the “zillion” answers in this Stack Overflow Question.
UPDATE: This method seems to be only valid for OS X 10.6.x, previous OS X versions used the non-POSIX path style that looked like path:to:file, whereas the POSIX would be path/to/file. If you are in something older than OS X 10.6, you will have to try one of the other methods described in the other answers (or upgrade to 10.6 ;)
There are two ways I do this (and the info window is neither of them):
...select an item in the Finder and run this...
tell application "Finder"
return info for selection as alias
end tell
...or create a droplet with this code...
on open theFile
set thePath to POSIX path of theFile
set the clipboard to thePath as text
end open
Add salt to taste.
The best and easiest way to do this is by creating a "copy path" service, very similar to the shift + Right-Click on a Windows machine.
If you frequently need to copy and paste file and folder paths, creating an Automator Service will make your life easier because the service then becomes accessible from the OS X Right-Click contextual menu, accessible from anywhere in the Finder.
Follow these steps to set it up (screenshots below).
Save the Service with a name like “Copy Path”.
The result:
You'll now have the textual path in your clipboard.
Service
is now called Quick action
(a great innovation, goes without saying.)
Commented
Dec 15, 2018 at 13:57
Simply drag the file into text editor, and it will give you the full path for that file.
Method 1:
In macOS holding the ALT key
(⌥) often shows extra options in context menus.
Copy "item" as Pathname
.
Detail https://apple.stackexchange.com/a/318007/302207
Method 2: If you use TotalFinder, you can Allow path copying from Context Menus
TotalFinder makes it really easy to capture a variety of path formats for a selected object. Right-click on any file or folder, select Copy Path, and select the path format you'd like copied to the clipboard.
TotalFinder setting path:
This is how to create a Service to copy to the clipboard the selected paths in Finder:
files or folders
in Finder.app
"./bin/bash
", "Pass input: as arguments
" and type the following in the script box: for f in "$@" do echo "$f" done
.~/Library/Services/Copy POSIX Paths.workflow
(or any other name you like).Now you will be able to run this service if you right click an element and choose Services > Copy POSIX Paths. It will copy the file(s) selected in Finder to your clipboard. I tested this on Lion.
I got this tip from Kris Johnson's Blog.
I will move my comment over as an answer.
You should be able to copy the path to a folder/file by highlighting the value next to "Where:" in the info dialog and pressing CMD+c
.
An easier alternative that requires less effort is right-clicking on that value, and clicking "Copy" in the drop-down that appears.
Paste this script
on run {input, parameters}
set mylist to {}
repeat with elem in input
try
set the end of mylist to (POSIX path of (elem as alias))
end try
end repeat
set oldtid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {return}
set flatlist to mylist as text
set AppleScript's text item delimiters to oldtid
tell application "Finder" to set the clipboard to flatlist
-- code below will also create an email with the path inside. delete it if you don't want that.
tell application "Microsoft Entourage"
set theMessage to make new outgoing message with properties {subject:myFileName, content:flatlist}
open theMessage
activate
end tell
end run
Sometimes the solution is so simple.
Just mark the file in the finder and then press Command-C. The path including the file name is copied to the clipboard and you can paste it in any application.
CMD+c
to copy it?Copy
in it