I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- Null-terminated string, opening file for reading
If you can, I strongly suggest you
tar
andbzip
(orgzip
, whatever floats your boat) the directory on the remote machine—for a directory of any significant size, the bandwidth savings will probably be worth the time to zip/unzip.If you want to stick to command line FTP, you should try NcFTP. Then you can use get -R to recursively get a folder. You will also get completion.
Just to complement the answer given by Thibaut Barrère.
I used
Note the double slash after the server name. If I don't put an extra slash the path is relative to the home directory of user.
You should not use
ftp
. Liketelnet
it is not using secure protocols, and passwords are transmitted in clear text. This makes it very easy for third parties to capture your username and password.To copy remote directories remotely, these options are better:
rsync
is the best-suited tool if you can login viassh
, because it copies only the differences, and can easily restart in the middle in case the connection breaks.ssh -r
is the second-best option to recursively copy directory structures.See:
rsync man page
ssh man page
If you can use
scp
instead offtp
, the-r
option will do this for you. I would check to see whether you can use a more modern file transfer mechanism than FTP.If
lftp
is installed on your machine, usemirror dir
. And you are done. See the comment by Ciro below if you want to recursively download a directory.