I want to copy files from a remote server to my desktop and vice versa. However, the issue is, my files to be copied from the server have quite long file paths with at least 7-8 subfolders which are more or less constant.

It's hectic to use the entire file path all the time to perform simple copy actions. for eg, if I wanted to copy filex from the remote server I would have to type in:

scp -r username@remotesrvr.com:/fldr1/fldr2/fldr3/fldr4/..../myfile ./mydesktop

Is there a way to overcome this?


One trick that I use constantly is to mount via SSH a remote directory rather than use some cumbersome scp command.


First mount the remote directory.

$ mkdir $HOME/mnt
$ sshfs user@remote:/fldr1/fldr2/fldr3/fldr4/.../myfile $HOME/mnt

From this point you can now copy files to/from $HOME/mnt locally and it will be hitting the remote server's directory. Use standard tools such as cp, mv, etc.

When you're done you can unmount this connection.

$ fusermount -u $HOME/mnt

I think using a package like fileZilla makes it much faster and it does exactly what I want!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.