I have downloaded numerous hdf files from an ftp site. Let's say I already have 500 hdf files, 250 of them were level 1 hdf files and the rest were level 2. The level 1 format is: A2001031505000.L1A_LAC.sample.hdf and the level 2 format is: A2001017054000.L2_LAC.sample.hdf
As what you will observe they differ in this part L1A_LAC, L2_LAC. Now, how will I do a batch process in projecting all the level 2 hdf files only? How will I filter these files and create a new directory for the filtered files?

Any help will be appreciated.
Thanks!


Here's what I have so far:
    
    def inputData(self, event):
                   
        def findSDS (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'
            path = 'D:/SeAHABS/Geoloc' 
            outTIFF = path + 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)
            os.mkdir(path)