0

I am using ssh to connect to a server. I want to upload local files to the server. Usually I do this by opening the 'New File Transfer Window' However, i'd like to just do this from the command prompt.

what is the command to do this?

joschi
  • 21,387
  • 3
  • 47
  • 50

3 Answers3

2

You can do this with rsync.

Something like this should suffice:

rsync -av /path/to/Desktop/ server.name:/path/to/destination

The -av tells rsync to 'archive' (maintains permissions, acts recursively, etc) and to be verbose (print transferred filenames).

Note: if you leave a trailing / at the end of 'Desktop', the contents of the Desktop will be transferred. Without the slash, all documents will be transferred into a folder called 'Desktop' on the destination.

snk
  • 392
  • 3
  • 4
  • 10
1

Since you mention the "New File Transfer" window, my guess is that you're using the ssh.com SSH2 client.

SCP2.EXE is the program to copy files over ssh from the command line.

quadruplebucky
  • 5,139
  • 20
  • 23
  • yes I use ssh2. but why do i need to download scp2.exe. cant I just use the terminal window to transfer files? –  Mar 11 '10 at 16:15
  • That terminal window is open on the *server*. So any transfers you initiated there would be from that server. It would require a similar SSH server on your side to accept the transfer request. To do something on a terminal, you would need something local, like a command prompt. Then call SCP2.exe, or Putty's pscp.exe. – Christopher Karel Mar 11 '10 at 16:24
0

Sometimes for small text files I copy the contents to the clipboard then paste it to cat in the terminal window. E.g.

  1. Copy text
  2. cat > path/to/file
  3. Paste the file (Shift-Inset) works in putty
  4. Type enter if the file doesn't end in one (makes next key stroke work)
  5. Type Ctrl-D to terminate the input stream
Xian
  • 197
  • 6