Search code examples
linuxwget

wget download hdf file in a MODIS URL


I try to use wget to download a large amount of data from NASA MODIS dataset. They provide data pool link, e.g. https://e4ftl01.cr.usgs.gov/MOLT/MOD11A2.061/2000.02.18/.

In the link, there are jpg, xml, and hdf files. I only need the hdf file.
If I run

wget https://e4ftl01.cr.usgs.gov/MOLT/MOD11A2.061/2000.02.18/ --user=XXX --password=XXX -P XXX/XXX/XXX

then, everything would be downloaded.

So, how to write this command to download only hdf files.
Thank you, best wishes.


Solution

  • I suggest following solution

    wget --recursive --level=1 --accept hdf https://e4ftl01.cr.usgs.gov/MOLT/MOD11A2.061/2000.02.18/ --user=XXX --password=XXX -P XXX/XXX/XXX
    

    this turn out recursive retrieval feature, level is used to limited to only 1 step (i.e. only links in given page), accept to specify acceptable suffixes (in this case only hdf). Not tested as I do not have access to said files. See wget manpage for details.