wget:检查文件时间戳和覆盖 [英] wget: Checking for file timestamp and overwriting
问题描述
我怎样才能让 wget
做到这一点:
从 x
位置下载文件,仅当文件的本地副本具有比 x
上的文件时间戳旧的时间戳时.这意味着,它应该从给定的位置下载文件,前提是文件有更新版本.
如果有更新版本的文件,wget
应该覆盖该文件.
可以这样做吗?
听起来您正在寻找 wget 的时间戳功能:http://www.gnu.org/software/wget/manual/wget.html#Time_002dStamping
<块引用>假设你想下载一个文件以便它保持其日期修改.
wget -S http://www.gnu.ai.mit.edu/
<块引用>
一个简单的 ls -l 显示本地文件上的时间戳等于当前文件的状态Last-Modified 标头,由返回服务器.如您所见,时间戳信息被保留本地,即使没有-N"(至少对于 http).
几天后,你想wget 检查远程文件是否有已更改,如果已更改,请下载.
wget -N http://www.gnu.ai.mit.edu/
How can I get wget
to do this:
Download a file from a location say x
, only if the local copy of the file has an older time stamp than that of the file's time stamp on x
. That means, it should download a file from a given location, only if there is a newer version of the file.
In case there is a newer version of the file, wget
should overwrite the file.
Is it possible to do this?
Sounds like you're looking for the TimeStamping functionality of wget: http://www.gnu.org/software/wget/manual/wget.html#Time_002dStamping
Say you would like to download a file so that it keeps its date of modification.
wget -S http://www.gnu.ai.mit.edu/
A simple ls -l shows that the time stamp on the local file equals the state of the Last-Modified header, as returned by the server. As you can see, the time-stamping info is preserved locally, even without ‘-N’ (at least for http).
Several days later, you would like Wget to check if the remote file has changed, and download it if it has.
wget -N http://www.gnu.ai.mit.edu/
这篇关于wget:检查文件时间戳和覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!