Moving a folder from Desktop to the server?

Léo Léopold Hertz 준영 picture Léo Léopold Hertz 준영 · Feb 26, 2009 · Viewed 32.7k times · Source

I have a folder in my Desktop. I want to copy it to my server in Terminal.

I tried this unsuccessfully

[~/bin]# cp -r /Users/Sam/Desktop/tig-0.14.1 ~/bin/
cp: cannot stat `/Users/Sam/Desktop/tig-0.14.1': No such file or directory

[edit]

I run the command in my server. The problem seems to be in the fact that "/Users/Sam/Desktop/tig-0.14.1" is a folder in my Mac, not in my server.

Perhaps, I cannot move the folder so simply to my server because my server do not know where my folder locates.

I have always moved the folder by GUI. Is the same possible also just in terminal?

Answer

Nathan Stocks picture Nathan Stocks · Feb 26, 2009

From the server:

scp -r [email protected]:~/Desktop/tig-0.14.1/ ~/bin/

username is your shortname on your local mac. A.B.C.D is the IP address of your local mac as seen by the server. You will be prompted for your password.

Or if you wanted to push from your local client:

scp -r ~/Desktop/tig-0.14.1/ [email protected]:~/bin/

serveruser is the user on the server whose ~/bin you want to copy into. W.X.Y.Z is the IP address of the server as seen by your client. You will be prompted to enter serveruser's password.

scp is part of ssh. See 'man scp' (from the terminal) for more info.