I have downloaded files from an ftpsite(the files uploaded are delayed one day, means the files for today aren't available so the newest files available are the hdf files yesterday and so on). These files have level 1 and level 2 modis hdf. First, I need to do a batch process in projecting all the level 2 hdf files only(since I already have 500 hdf in my local directory). And second, I need to batch process all those newest files only that were added in the ftp site.

Thanks!


Here's what I have so far:

 
    def projectData(self, event):
        
        def findRasters (path, filter):
            for root, dirs, files in os.walk(path):
                for file in fnmatch.filter(files, filter):
                    yield file

         for sds in findSDS('/path/to/file', '*.hdf'):
            inSDS = 'HDF4_SDS:' + '/path/to/file' + '/' + sds + ':01' 
            outTIFF = 'path/tiff/files + sds + '.tif'
            cmd = 'gdalwarp -geoloc -t_srs "proj=longlat +datum=WGS84" -te 113.205 1.120 157.105 2.005 %s %s' % (inSDS, outTIFF)

            os.system(cmd)