Break On
:Search
"Searching " ?
DIM $SPath,$SFile ; reset the $Vars
$aMonate = Split(' ,JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC', ',') ; Month in an Array (just set the "X" to " " for testing)
$SPath = 'c:\Testing\' ; Source
$DPath = 'C:\t2\' ; Target
$File = Dir($SPath + '*.*')
; get first file name
While Not @ERROR
$FileDate = GetFileTime($File)
$FileYear = SubStr($FileDate,1,4)
$FileMonth = $aMonate[Val(SubStr($FileDate, 6, 2))]
$FileDay = Right('0'+SubStr($FileDate,9,2),2)
; $TypeFound = 0
$DstDir = $DPath + $FileYear + '\' + $FileMonth + '\' + $FileDay
If Not Exist($DstDir)
; 'MD ' $DstDir ? ; for debugging
MD $DstDir ; creating target des
EndIf
SLEEP 1 ; slowing down for checkinhg
If Exist($File) "Copying " $SPath + $File ?
; copying or moving the files to the target des
; Move ' $Path + $File + ' ' + $DstDir ; for debugging
Copy $SPath + $File $DstDir ; copy the files into the target des
; Move $SPath + $File $DstDir ; move the files into the target des
Else
GOTO "Search"
EndIf
SLEEP 1
; DEL $SPath + $File ; delete the files from the source des
; "deleting " $SPath + $File ?
$File = Dir() ; get the next file
Loop