3

Possible Duplicate:
How do you recursively ftp a folder in linux

I'd like to simply upload a directory and all of its contents, recursively, from the command line. To do this from the command line would be so much easier than resorting to FileZilla or some other windowed app.

My workaround for this has been to zip, then upload the zip w/FTP, then SSH and unzip...

Is there a way using the BASH command line ftp to upload multiple files and directories?

Looking at the available commands there is only put and send which allow only a single file and no directory.

Community
  • 1
  • 1
Tapefreak
  • 982
  • 1
  • 13
  • 16

2 Answers2

4

If you have access to SSH, can you also use scp? If so, try something like:

scp -r local_dir you@server:remote_dir

The -r flag allows you to recursively copy to your destination.

Michael
  • 2,181
  • 14
  • 14
2

Here's a technique that doesn't use ftp, since you already have ssh access:

tar czf - [your files here] | ssh user@host 'cd /dir && tar xzf -'

Create a tar file on stdout, and pipe to ssh where it will untar from stdin.

glenn jackman
  • 238,783
  • 38
  • 220
  • 352