使用 wget 从受密码保护的 url 下载文件

Downloading files from password protected urls using wget

我正在从受密码保护的服务器上下载许多文件。他们建议使用: wget -i urllist.txt --用户名 --ask-密码 下载文件。我可以下载文件,但问题是我想用 运行 这个脚本的每一步更改所有文件,这样我就有了正确的文件名。 对于单个文件下载 - 输出选项有效,但对于许多文件,我遇到了问题。你能帮我吗?

我不确定你的意思:

I want to change all files with each step of running this script so that I will have the correct files name.

如果您将所有文件下载到一个文件夹,然后按照您想要的方式重命名它们,怎么样?

wget 手册说:

-P prefix --directory-prefix=prefix Set directory prefix to prefix. The directory prefix is the directory where all other files and subdirectories will be saved to, i.e. the top of the retrieval tree. The default is . (the current directory).

因此你可以使用:

wget -P download-folder -i urllist.txt --user name --ask-password

现在您调用手动重命名 download-folder 中的文件。