我目前正在使用以下 wget 命令从文件中的 URL 列表从 FTP 服务器下载:
wget --user=mylogin --password='mypassword' -P /home/ftp/ -i /var/www/file/url.txt -N
Run Code Online (Sandbox Code Playgroud)
但现在我需要一种同时下载多个文件的方法。我正在尝试为此使用 aria2,并尝试了以下命令:
aria2c -x 5 -i /var/www/file/url.txt
Run Code Online (Sandbox Code Playgroud)
但是我似乎找不到让 aria2 先登录到 FTP 的方法。
所以我的问题是,是否有一个命令让 aria2 首先登录到 FTP 服务器,然后从 URL 列表中下载?
或者,是否有更好的工具更适合我的任务?
谢谢
小智 8
从 man aria2c
--ftp-user=<USER>
Set FTP user. This affects all URIs. Default: anonymous
--ftp-passwd=<PASSWD>
Set FTP password. This affects all URIs. If user name is embedded but pass?
word is missing in URI, aria2 tries to resolve password using .netrc. If pass?
word is found in .netrc, then use it as password. If not, use the password
specified in this option. Default: ARIA2USER@
Run Code Online (Sandbox Code Playgroud)
所以你可以使用这样的东西
aria2c -j5 --ftp-user=yourname --ftp-passwd=password --input-file=list.txt
Run Code Online (Sandbox Code Playgroud)
另一种方式可能是gnu parallel(查看man parallel更多详细信息):
cat list.txt | parallel -j5 wget --user=mylogin --password=mypassword -P /home/ftp
Run Code Online (Sandbox Code Playgroud)