I was able to project all the level 2 hdf files and saved the projected files to the new(created) directory using this script:
set in_path=in_path
set out_path=out_path
md %out_path%
cd /d %in_path%
FORFILES /m *L2_LAC*.hdf /C "cmd /c gdalwarp -geoloc -t_srs EPSG:4326 -te 113.205 1.120 157.105 2.005 HDF4_SDS:hdf:@file:01 %out_path%\@fname.tif"*
But there is one last thing that I need to make this goal complete:
How am I going to automatically detect all the newest projected images that were added to the directory from time to time and then project it immediately?Because everyday I am downloading hdf files and then if there are new files I'll project it from time to time which is a waste of time. That's why I need it in batch process and automatic. How will I complete this project using the script below?
for /f "tokens=1,2,5" %a in ('dir /-b /o-d /tc') do @if %a==%date:~4% (if %b==%time:~0,5% (echo %c)