tags:

views:

237

answers:

1

I wish to get a particular set of files and the only access I have on that box is through the http inteface, which I can get from wget. Now the issue is that I want the latest files, and there are multiple which must be of the same time stamp.

wget http://myserver/abc_20090901.tgz
wget http://myserver/xyz_20090901.tgz
wget http://myserver/pqr_20090901.tgz

The issue being that I do not know if all the above files exist and I wish to get only when all 3 files with the above time stamp exist.

The other issue is that I have another file in a separate folder which is also to be obtained. How do I get these files? Any suggestions?

wget http://myserver/text/myfile_20090901.txt
+1  A: 

wget offers some basic resource presence detection with its --spider option. Something like this should do the trick:

wget --spider http://myserver/abc_20090901.tgz     &&
wget --spider http://myserver/xyz_20090901.tgz     &&
wget --spider http://myserver/pqr_20090901.tgz     &&
wget          http://myserver/abc_20090901.tgz     &&
wget          http://myserver/xyz_20090901.tgz     &&
wget          http://myserver/pqr_20090901.tgz     &&
wget          http://myserver/text/myfile_20090901.txt
JB