PDA

View Full Version : [SOLVED] how do I use file URIs in the terminal?



jobsonandrew
July 28th, 2011, 09:59 PM
if I have a file URI like this:

smb://<server>;<user>@<domain>/public/file.jpg
or

file:///some/file/path
how can I use them in the terminal (or script) with commands like mv and cp?

Bachstelze
July 28th, 2011, 10:19 PM
You can't. mv and cp work on filesystems, and on nothing else. What you can do is mount the Samba share as a fiesystem with smbfs, then you can use mv and cp on it, but you will use the filesystem paths, not the smb:// addresses.

AlphaLexman
July 28th, 2011, 10:27 PM
smb:// file:// http:// ftp:// are ALL types of communication protocols. Most web browsers and many file managers can translate the protocols. Unfortunately, your shell interpreter cannot.

jobsonandrew
July 28th, 2011, 10:29 PM
ok, so are you saying the only way to use a file URI in the terminal would be to parse that URI and find the equivalent folder in:

~/.gvfs/share_name/file_name
?? seems a bit long winded....

AlphaLexman
July 28th, 2011, 10:48 PM
Take a look at 'man scp' it is a secure copy command that can handle ports.

You really don't want to move 'mv' files across different filesystems, it is just too risky.

jobsonandrew
July 29th, 2011, 10:27 PM
I found the answer


sudo apt-get install gvfs-bin

then


gvfs-copy "source" "destination"

quotes around the source and target so bash doesn't parse the ';' if present

:)