Need batch script for Windows (XP or server 2003) which will scan source folder and its subfolders, in subfolders the files are being downloaded, script has to check filesize and store it in a file, next time script starts, it should check what is the stored size and compare to the current, if size has not changed - download is complete, do something at this point (move for example, or call another batch), if the filesize has changed - store new size.
## Deliverables
Here is the algorythm of script I am looking for:
The sample of structure of the folder that has to be scanned:
C:\INCOMING\
"download folder 1 (15-01-2010 00-00-00)"
[login to view URL]
"download folder 2 (25-01-2010 03-00-00)"
[login to view URL]
and so on, date/time format is dd-mm-yyyy hh-mm-ss.
each subfolder has file named [login to view URL] for example, filename is the same in all subfolders
define source folder in case it has to be moved or different (C:\INCOMING)
begin scan $sourcefolder
when first folder found, check if the file [login to view URL] exist in there
if [login to view URL] does not exist, bring a message to the screen and exit here, proceed next folder
if [login to view URL] exist, check for stored filesize in a separate file ([login to view URL] for example)
if [login to view URL] does not exist (means first scan), get the size of [login to view URL] and put it in [login to view URL], check if [login to view URL] was created and proceed next folder, if it was not created for some reason (disk full, permission denied, etc), display a message and proceed next folder.
if [login to view URL] exists, get current filename and compare to the one stored in storedsize.txt.
if current filesize equals to the stored, then do action here (described below).
if current filesize is greater than the stored, update [login to view URL] with current size, check if [login to view URL] was created and proceed next folder, if it was not created, display a message and proceed next folder.
At the point when it was verified that [login to view URL] has not been changed means it is done downloading and ready to be processed. [login to view URL] then has to moved to a different folder (c:\tocompress for example), renamed as its parent folder name, spaces in file name (or parent foldername) have to be replaced with "_", so at the end [login to view URL] would look like download_folder_1_(15-01-2010_15-10-33).dat