wget - 如何使用 wget 从 http 服务器下载所有仅包含“480p”的文件?

wget - how to download all files that only include "480p" using wget from http server?

我想从 http 服务器下载所有文件,例如: http://dl.mysite.com/files/ 我还想进入该文件夹内的每个文件夹。 但我只想下载名称中包含“480p”的文件。

使用 wget 最简单的解决方案是什么?

编辑:

我想让那个脚本在每晚从凌晨 2 点到早上 6 点 运行 将那些文件从该服务器同步到我的电脑。

以下 wget 命令应使用以下标志:

wget -A "*480p*" -r -np -nc --no-check-certificate -e robots=off http://dl.mysite.com/files/

解释:

-A "480p" 你的模式

-r, recursively 递归查看文件夹

-np, --no-parent 忽略指向更高目录的链接

-nc, --no-clobber 如果一个文件在同一个目录下被多次下载,Wget 的行为取决于几个选项,包括‘-nc’。在某些情况下,本地文件会在重复下载时被破坏或覆盖。在其他情况下,它将被保留。

--no-check-certificate不要根据可用的证书颁发机构检查服务器证书。

-e, --execute command 这样调用的命令将在 .wgetrc

中的命令之后执行

robots=off 机器人排除

有关 wget 标志的更多信息可在官方 GNU 手册页中找到:https://www.gnu.org/software/wget/manual/wget.html

关于每天 运行 一次,您可能需要阅读 Cron 个职位。摘自文档页面:https://help.ubuntu.com/community/CronHowto

A crontab file is a simple text file containing a list of commands meant to be run at specified times. It is edited using the crontab command. The commands in the crontab file (and their run times) are checked by the cron daemon, which executes them in the system background.

所以基本上你需要把你的wget命令放到一个文件中,并在指定的时间将cron设置为运行这个文件。

注意:Windows 没有 Cron 的本机实现,但您可以使用 Windows 任务计划程序[=55= 实现相同的效果].