我们经常会需要在linux shell中执行文件/文件夹的传输操作。此时,使用ftp是个不错的选择。推荐使用ncftp。
- 安装ncftp
sudo apt-get install ncftp - 上传/下载
上传:ncftpput -R -u username -p password -P port remote_dir local_dir
下载:ncftpget -R -u username -p password remote_dirlocal_dir
下载文件夹到本地的话,会包含远程目录的全路径。如果想下载后自动去除上级目录,可以使用wget。
wget -r -nH -nc --cut-dirs=number ftp://user:password@servername/remote/dir/path/* local_dir
* -nH avoids the creation of a directory named after the server name
* -nc avoids creating a

本文介绍了如何在Ubuntu Shell中使用ncftp进行FTP的文件上传和下载操作。ncftp是推荐的工具,而如果需要在下载文件夹时去除上级目录,可以使用wget。
最低0.47元/天 解锁文章
1416

被折叠的 条评论
为什么被折叠?



