Is there a particular reason that you have to use FTP? Because if not, then SCP is going to be a better option. First because it uses an encrypted channel to send the files (no cleartext passwords for Google StreetView cars to record :-), second because it can use private key authentication, and third because it's really meant for copying.
Regardless, tar
is the standard way to create a single file out of a directory, and the -z
switch will use GZIP compression.
tar -zcvf OUTFILE.tgz DIRECTORY
Then you need to encrypt it. I use ccrypt
, but there are other options. And maybe there are reasons not to use it that I don't know about.
ccrypt -k KEYFILE OUTFILE.tgz
Finally, copy it to your destination server. I'll assume that you have a "Transfer" directory under your home directory, and have set up private-key authentication.
scp OUTFILE.tgz.cpt YOURHOST:Transfer
If FTP really is a requirement, you can use curl
to do the transfer. I've never done this myself (and have no FTP server with which to try it), but a quick read of the manpage indicates the following:
curl --upload-file OUTFILE.tgz.cpt -u USER:PASSWORD ftp:://YOURHOST/HOSTPATH
Yes, there is a reason I have to use FTP.
ccrypt has no keys or are they created/stored separately? – Kristoffer L – 2010-05-26T06:47:20.773
Although the other answer seems to be what you want, I'll leave mine for someone else. I've edited to mention
curl
, and how to get a key from a file;man ccrypt
will give you more info. – Anon – 2010-05-26T14:08:13.177