SSH SFTP: transfer local directory to remote server

2

I can't seem to transfer a simple local folder to a remote server via SFTP or SSH. I feel like the issue has to do with absolute paths or home directories, but here's what I've tried:

scp -r /Applications/MAMP/rest/of/path user@myserver.com:/remote/path
rsync -az --progress --stats -e ssh /Applications/MAMP/rest/of/path user@myserver.com:/remote/path

All I keep getting is a 'no such file or directory' in reference to the local path.. I dragged n dropped the local folder path into terminal, but while already logged into ssh - would that make any difference? last few hours stuck in a matrix..

burtonguster

Posted 2013-02-22T12:03:12.977

Reputation: 21

1Do you have any "weird" characters in the path name, such as spaces? In that case, they need to be escaped. You could try and write the path via tab completion instead of drag and drop to check if the shell sees it. – Daniel Andersson – 2013-02-22T13:16:54.760

there are no weird characters or spaces that would require 'single quotes' or "" – burtonguster – 2013-02-22T23:43:24.670

1Are you running this command sshed into the remote server? If so, don't. You have to run the command from your local computer. – cpast – 2013-03-12T01:13:33.900

Answers

2

scp is plain and simple, if you have rsync, use it, its a lot smarter.

also, drop the -e ssh , as its the default.

i assume you already check the permissions for the correct users in boths sides, so i recommend you first CD the origin directory and run the rsync from there

cd /Applications/MAMP/rest/of/path 
ls -l     # to confirm you are on the right place
rsync -avz --progress --stats  . user@myserver.com:/remote/path

higuita

Posted 2013-02-22T12:03:12.977

Reputation: 470

i tried that and the error message was the same - I'm taking that to mean the local absolute path is not correct once inside ssh.. when I type '~/Applications/MAMP/rest/of/path' I get the ssh path prepending my local like so, '/var/www/web/htdocs/Applications/MAMP/rest/of/path' – burtonguster – 2013-02-22T23:49:29.750

Lastly, when I do this, $ ssh localhost -t 'exec bash -ilc "exec screen -RD"' I get 'bash: exec: screen: not found Connection to localhost closed' - Why can't I do this simple sftp? arghh – burtonguster – 2013-02-22T23:56:26.860