有没有一种简单的方法可以使文件夹通过HTTP与目录列表同步?
编辑:
感谢wget的提示!我创建了一个shell脚本并将其添加为cron作业:
remote_dirs=( "http://example.com/" "…") # Add your remote HTTP directories here
local_dirs=( "~/examplecom" "…")
for (( i = 0 ; i < ${#local_dirs[@]} ; i++ )) do
cd "${local_dirs[$i]}"
wget -r -l1 --no-parent -A "*.pdf" -nd -nc ${remote_dirs[$i]}
done
# Explanation:
# -r to download recursively
# -l1 to include only one directory depth
# --no-parent to exclude parent directories
# -A "*.pdf" to accept only .pdf files
# -nd to prevent wget to create directories for everything
# -N to make wget to download only new files
编辑2:
如下所述,也可以使用--mirror
(-m
),它是的简写-r -N
。
很高兴它有所帮助。您能否接受最能帮助您解决问题的答案?
—
乔治M