FMS Posted June 18, 2014 Share Posted June 18, 2014 Dear reader, I recently made a simple script to copy files to another location for backup services. While 1 $search = FileFindFirstFile("C:\test\*.pdf") If $search = -1 Then sleep(60000) Else $file = FileFindNextFile($search) filemove("C:\test\" & $file,"Z:\test",8) EndIf FileClose($search) WEnd now there are not only pdf files in the dir "test" but more files (.exe , .bat etc) and sub dir like C:testtest2 I would like to also copy the directory's to the other location but don't understand how.... Zould somebody please help me or point me in the wright direction greez FMS as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 18, 2014 Moderators Share Posted June 18, 2014 If you're looking to copy the entire directory, look at DirCopy in the help file. If you only want certain files, look at _FileListToArray and use the filter to grab only the files you want. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FMS Posted June 18, 2014 Author Share Posted June 18, 2014 thanks for the tip.... I looked in to it but,.. do you also know a way to check if there is a new file in the "sub dir" and iff so fire a dircopy command? thanks in advanced as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 18, 2014 Moderators Share Posted June 18, 2014 (edited) Just to clarify, are you asking how to monitor a directory and if a new file is found move just that file? Or move the whole directory? Or just the pdf files? Can you please be a bit more specific? Edited June 18, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FMS Posted June 19, 2014 Author Share Posted June 19, 2014 yes i mean how to monitor a directory and if a new file is found move the whole directory as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 19, 2014 Moderators Share Posted June 19, 2014 Rather than re-write something, I would suggest you take a look at this thread where Melba presents a solid example of monitoring a directory. I would also encourage you to think about keeping a running list of the files in the directory (written to a text file, kept in an array, etc.) so that you're only moving those files that have been added. This will cause a lot less overhead than moving the entire directory each time. '?do=embed' frameborder='0' data-embedContent>> "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FMS Posted June 24, 2014 Author Share Posted June 24, 2014 thnx JLogan i looked into it and just what i needed... (i think at the moment) justy posted there a question for Melba as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now