2

A directory listings enabled folder has 2 zip files. I am trying to download only one of them (the latest). Problem is the zip file name is a random string.

The command I have so far is

wget -r -nH --cut-dirs=3 --no-parent --accept=zip http://192.168.1.21/files/$name/?C=M;O=A

This seems to download all the zip files. I wish to download the first one wget will hit. Is there a way to do this?

user3227965
  • 98
  • 1
  • 7

1 Answers1

2

If the size of the zipfiles is significantly larger than the rest of the data, you could set --quota=max size of the smallest zipfile, note that wget won't stop downloading if the quota is exceeded while downloading a file:

   -Q quota
   --quota=quota
       Specify download quota for automatic
       retrievals.  The value can be specified in
       bytes (default), kilobytes (with k suffix),
       or megabytes (with m suffix).

       Note that quota will never affect downloading
       a single file.  So if you specify wget -Q10k
       ftp://wuarchive.wustl.edu/ls-lR.gz, all of
       the ls-lR.gz will be downloaded.  The same
       goes even when several URLs are specified on
       the command-line.  However, quota is
       respected when retrieving either recursively,
       or from an input file.  Thus you may safely
       type wget -Q2m -i sites---download will be
       aborted when the quota is exceeded.

       Setting quota to 0 or to inf unlimits the
       download quota.