
--page-requisites
メッセージ ボードをアーカイブしたいのですが、パラメータ、、--span-hosts
および--convert-links
を指定して wget を使用します--no-clobber
。
問題は、--convert-links
を使用する--no-clobber
と、スレッド ページごとに、wget がサイトのスキン、スクリプト、アイコンを再ダウンロードすることです (最新の状態に保つため)。
wget がローカルに既に存在するファイルをダウンロードしたり、ファイルへのリンクをローカル コピーに参照したり、ファイルシステムにまだ存在しないファイルのみをダウンロードしたりしないようにする方法はありますか?
答え1
スイッチを追加すると、タイムスタンプの使用が-N
強制されると思いますwget
。
-N
--timestamping
Turn on time-stamping.
このスイッチを使用すると、wget
ローカルにまだ存在しないファイルのみがダウンロードされます。
例
ファイルがrobots.txt
ローカルに存在しない場合はダウンロードします。
$ wget -N http://google.com/robots.txt
--2014-06-15 21:18:16-- http://google.com/robots.txt
Resolving google.com (google.com)... 173.194.41.9, 173.194.41.14, 173.194.41.0, ...
Connecting to google.com (google.com)|173.194.41.9|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/robots.txt [following]
--2014-06-15 21:18:17-- http://www.google.com/robots.txt
Resolving www.google.com (www.google.com)... 173.194.46.83, 173.194.46.84, 173.194.46.80, ...
Connecting to www.google.com (www.google.com)|173.194.46.83|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘robots.txt’
[ <=> ] 7,608 --.-K/s in 0s
2014-06-15 21:18:17 (359 MB/s) - ‘robots.txt’ saved [7608]
ファイルをrobots.txt
ローカルでもう一度試してみます:
$ wget -N http://google.com/robots.txt
--2014-06-15 21:18:19-- http://google.com/robots.txt
Resolving google.com (google.com)... 173.194.41.8, 173.194.41.9, 173.194.41.14, ...
Connecting to google.com (google.com)|173.194.41.8|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/robots.txt [following]
--2014-06-15 21:18:19-- http://www.google.com/robots.txt
Resolving www.google.com (www.google.com)... 173.194.46.82, 173.194.46.83, 173.194.46.84, ...
Connecting to www.google.com (www.google.com)|173.194.46.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Server file no newer than local file ‘robots.txt’ -- not retrieving.
2 回目は、wget
ファイルを再度取得しなかったことに注意してください。