Copy file and folder path from Nautilus

How can I copy the file and folders full path in Nautilus? In the right-click context menu there is no such option provided. In file/folder property window I can only copy the folder path.


Solution 1:

To quickly get a file path in Nautilus we can use the right click context entry "Copy" to copy the file path to the clipboard.

Then just "Paste" (resp. "Paste Filenames") this path from the clipboard to the other application, e.g. a text editor.

Solution 2:

You can use to copy folder path from Nautilus the command

Ctrl + l

Solution 3:

Unfortunately pasting file path from Nautilus to GNOME Terminal does not work as expected. It pastes the path as an URL with URL encoded characters. For example it pastes:

 file:///etc/gconf/gconf.xml.defaults/%25gconf-tree.xml

instead of

 /etc/gconf/gconf.xml.defaults/%gconf-tree.xml

Solution with clipboard

Use the Edit > Paste Filenames function from the terminal menu which also takes care of escaping for a shell. Unfortunately this function does not have a keyboard shortcut (besides Alt+E+F) and it seems that it is not possible to set one using gconf-editor.

See also Nautilus copy file/directory path should not put "file://" prefix.

Solution with drag & drop

Dragging a file or directory from Nautilus to GNOME Terminal transfers the correctly formatted path like Edit > Paste Filenames mentioned above.

Solution 4:

I found a solution to this. You can use Nautilus actions utility to add "Copy path" and "Copy directory path" the the context menu.

This seems to work well.

Source. Don't forget to make the .py-file executable.