Option Explicit ' To omit confirmation message, set 00 instead of 99 Const debugFlag=99 Dim vStartDate,vEndDate Dim oFS,oShell Dim sCommand Dim sSrcPath,sDestPath Dim sGashu,iInterval Dim sFileName,sOutName Dim i,j Dim vDate set oFS = CreateObject("Scripting.FileSystemObject") set oShell = CreateObject("WScript.Shell") ' Input folder name sSrcPath = "2010\" ' Output foler name sDestPath = "TEST\" ' Start and end time of GPV extract (year, month, day) and (hour, minute, second), second is always set as 00 ' End time should be set 30 minutes after the time to be extracted vStartDate = DateSerial(2010,01,01) + TimeSerial(00,00,00) vEndDate = DateSerial(2010,01,03) + TimeSerial(12,30,00) ' Time intreval (hour) of extracted image iInterval = 12 ' Header of input file sGashu ="GS" '---------------------------------------------------------------------------------- '@@@If no output folder is found, a new folder is created if oFS.FolderExists(sDestPath)=false then oFS.CreateFolder(sDestPath) vDate = vStartDate Do While vDate<=vEndDate sFileName = sSrcPath & MakeFileName(vDate,sGashu) sOutName = sDestPath & MakeFileName1(vDate,sGashu) sCommand = "cmd /c Cnvgpv.exe " & sFileName & " " & sOutName & " GPV.INI" if debugFlag <>0 then WScript.Echo sCommand oShell.run sCommand,0,TRUE vDate = vDate + iInterval/24 Loop Msgbox "Cut completed",vbOkonly,"Confirm" WScript.Quit(99) set oFS = Nothing set oShell = Nothing '---------------------------------------------------------------------------------------------------- Function MakeFileName(vDate,sGashu) Dim sHiduke(10) Dim i sHiduke(0) = Year(vDate) sHiduke(1) = Right(Year(vDate),2) sHiduke(2) = Month(vDate) sHiduke(3) = Day(vDate) sHiduke(4) = Hour(vDate) sHiduke(5) = Minute(vDate) for i=2 to 5 if CInt(sHiduke(i))<10 then sHiduke(i) = "0" & sHiduke(i) next 'i MakeFileName = sHiduke(2) & "\" & sGashu & sHiduke(1) & sHiduke(2) & sHiduke(3) & ".Z" & sHiduke(4) End Function Function MakeFileName1(vDate,sGashu) Dim sHiduke(10) Dim i sHiduke(0) = Year(vDate) sHiduke(1) = Right(Year(vDate),2) sHiduke(2) = Month(vDate) sHiduke(3) = Day(vDate) sHiduke(4) = Hour(vDate) sHiduke(5) = Minute(vDate) for i=2 to 5 if CInt(sHiduke(i))<10 then sHiduke(i) = "0" & sHiduke(i) next 'i MakeFileName1 = sHiduke(0) & sHiduke(2) & sHiduke(3) & sHiduke(4) & ".csv" End Function