tags:

views:

384

answers:

4

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?

+1  A: 

cp is not the correct command. Try scp instead; it has similar use and you can use it like this: (see the manual for reference)

from linux client: scp user1@host1://Users/Sam/Desktop/tig-0.14.1 ~/bin/

if you use a windows client you can use winscp to do this in "drag&drop" style

DrFalk3n
+1  A: 

cp: cannot stat /Users/Sam/Desktop/tig-0.14.1': No such file or directory`

That's the problem, alright: the file you're trying to copy is not where you thought, or not named what you typed. As suggested in comments you can try using tab completion at the prompt to make sure you have everything correct:

# cp /Users/Sam/Desk<TAB>
# cp /Users/Sam/Desktop/tig<TAB>
# cp /Users/Sam/Desktop/tig-0.14.1.tar.gz

Note that tig-0.14.1.tar.gz is probably the actual file name, as found in the wild...

dwc
+4  A: 

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.

Nathan
Thank you! It works now :)
Masi
+1  A: 

From your Mac (not the server):

# scp -r ~/Desktop/tig-0.14.1 myUsername@myServerName:~/bin

replace myUsername and myServerName appropriately.

eduffy