makeinstall Posted April 16, 2009 Share Posted April 16, 2009 I'm trying to get my head around the best way to solve this problem but I'm still a n00b with programming in general so I'm not coming up with viable, elegant solutions. The problem is thusly: I am writing a script to copy specific users files to a network location but there may be more than one of a particular file type. How do I find out how many there are and copy those up to my preselected network location? More specifically, its copying users email ID files but there is no uniformity to them because of a few reasons. 1. Some users have legacy ID's from a big changeover a couple of years ago whereas users employed less than 3 years ago have the new format. [old format is GBxxxxxx.id and the new is GBxxxx.id] 2. A few people have 2 or sometimes 3 of these ID files in their data folder so to only copy the first one found would be fatal to the process. I though that a good way would be to cycle through FileFindFirstFile & FileFindNextFile, add the results to an array and then later cycle through the array copying those files but my mind tends to go with the most elaborate [and therefore easily breakable] solution before looking for the simplest. Can anybody offer a good engineering solution or prod me in a new direction to think about the problem and eventual solution? Thanks in advance! ./chris Link to comment Share on other sites More sharing options...
Authenticity Posted April 16, 2009 Share Posted April 16, 2009 (edited) http://www.autoitscript.com/forum/index.ph...leFindFirstFileIt's weaponx's Regular Expression version of recursive file listing. Edited April 16, 2009 by Authenticity Link to comment Share on other sites More sharing options...
zorphnog Posted April 16, 2009 Share Posted April 16, 2009 No need for a complicated regular expression if you are only looking for files of the format GBxxxxxx.id and GBxxxx.id. You can just use a wildcard for your FileFindFirstFile filter (i.e. FileFindFirstFile("GB*.id")) Link to comment Share on other sites More sharing options...
makeinstall Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks zorphnog. I did poop myself a little when I started to look at those RegExp scripts after the sensation of something passing over my head had passed ;-) . But how will your suggestion find ALL of the file types in the folder? I think I'm asking the wrong question there. Whats the best way to store the results? Would it be to create a counter within FileFindNextFile loop and then assign the result to the value of $Array[counter]? Thanks for all the help. 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