ファイルを重複ダウンロードせずにwget参照をローカルコピーにします。

ファイルを重複ダウンロードせずにwget参照をローカルコピーにします。

メッセージ掲示板を保管したい。パラメータ(--page-requisites--span-hostsおよび)でwgetを使用してこれを実行します--convert-links--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ファイルは再検索されません。

おすすめ記事