How would I check a directory to see if the files in there stop growing in size , if the filesize stop growing for sometime, copy them to another directory. If the files still grow, then do nothing.
Thank you
Check file for size
Moderators: JRL, Dorian (MJT support)
Try something like this:
Code: Select all
//Set these three values appropriately
//Make sure "delay" (in seconds) is long
//enough to detect no further changes
Let>delay=2
Let>dir1=c:\test1
Let>dir2=C:\test2
/////////////////////////////////
Label>CheckSize
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size1
StringReplace>size1_1, ,,size1_1
Wait>%delay%
Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size2
StringReplace>size2_1, ,,size2_1
If>%size1_1%=%size2_1%,Continue,CheckSize
Label>Continue
Run>cmd /c xcopy "%dir1%" "%dir2%" /c /y
This is great
This is Great
Could I do this with the FTP site instead of the folder?
log in to the ftp site and check if the file stop growing then download?
thanks
Could I do this with the FTP site instead of the folder?
log in to the ftp site and check if the file stop growing then download?
thanks
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
You should be able to do that with FTP also
You can use FTPGetDirList and use as above for the folder.
And when ready do download you can use FTPGetFile.
You can check out the various FTP commands in the Help section.
You can use FTPGetDirList and use as above for the folder.
And when ready do download you can use FTPGetFile.
You can check out the various FTP commands in the Help section.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
This script works but I have a question
I modify the script to work with the ftp and it works fine, but I have a question
This is the script
Let>delay=3
Let>dir1=P:\Holding_Folder
Let>dir2=W:\File_in
/////////////////////////////////
Label>CheckSize
//Let>RP_WAIT=1
// Let>RP_WINDOWMODE=0
//Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
FTPGetDirList>this.ftp.site,user,pass,21,%dir1%\dirsize.txt,*,D
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size1
StringReplace>size1_1, ,,size1_1
Wait>%delay%
FTPGetDirList>this.ftp.site,user,pass,21,%dir1%\dirsize.txt,*,D
//Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size2
StringReplace>size2_1, ,,size2_1
If>%size1_1%=%size2_1%,Continue,CheckSize
Label>Continue
//Run>cmd /c xcopy "%dir1%" "%dir2%" /c /y
FTPGetFile>this.ftp.site,user,pass,%dir2%\,*.pdf,I
FTPDelFile>this.ftp.site,user,pass,21,/*.pdf
I have a question about the last two commands. Would this script check each file individually, or it check the whole folder and copy the whole folder. if it copy the whole folder and delete the whole folder, it may delete some of the new files just came in after the FTPGetFile command issued.
thanks
This is the script
Let>delay=3
Let>dir1=P:\Holding_Folder
Let>dir2=W:\File_in
/////////////////////////////////
Label>CheckSize
//Let>RP_WAIT=1
// Let>RP_WINDOWMODE=0
//Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
FTPGetDirList>this.ftp.site,user,pass,21,%dir1%\dirsize.txt,*,D
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size1
StringReplace>size1_1, ,,size1_1
Wait>%delay%
FTPGetDirList>this.ftp.site,user,pass,21,%dir1%\dirsize.txt,*,D
//Run>cmd /c dir "%dir1%" >%TEMP_DIR%~dirsize.txt
ReadFile>%TEMP_DIR%~dirsize.txt,data
Separate>data,File(s),data
Separate>%data_2%,bytes,size2
StringReplace>size2_1, ,,size2_1
If>%size1_1%=%size2_1%,Continue,CheckSize
Label>Continue
//Run>cmd /c xcopy "%dir1%" "%dir2%" /c /y
FTPGetFile>this.ftp.site,user,pass,%dir2%\,*.pdf,I
FTPDelFile>this.ftp.site,user,pass,21,/*.pdf
I have a question about the last two commands. Would this script check each file individually, or it check the whole folder and copy the whole folder. if it copy the whole folder and delete the whole folder, it may delete some of the new files just came in after the FTPGetFile command issued.
thanks