Khab Posted May 13, 2009 Posted May 13, 2009 (edited) EDIT: Updated, ok now it does call my function. Never mind Hi all,I am trying to make a script which will open all files (they are CSV's) in a given folder, whose filename matches a specific string format, and then perform a function on those files. The only issue I'm having, is I can't seem to get it to iterate through the relevant files. So, for example, there may be in the folder the filesUSERS_090509043511.CSVUSERS_100509043119.CSVUSERS_110509043344.CSVAnd I want to open each file, and then perform the operations. I can make it work if I specify the filenames - but these are generated by the system based on the timestamp when the file is created. There are other .CSV files in the folder that I do not wish to touch. Here is what I've tried:$fileRegEx = FileFindFirstFile("USERS_*.CSV") If $fileRegEx = -1 Then Exit EndIf While 1 $file = FileFindNextFile($fileRegEx) If @error = 1 Then ExitLoop EndIf MyFunction($file) WEndBut it never seems to actually run MyFunction() - I've tried setting that function to do nothing but open a message box saying it ran in order to test if it's being called, and even that doesn't happen. So, I believe I am doing something wrong with this section of code. I've checked the online documentation and tried a forum search, but still can't seem to see where I'm going wrong ... Any help would be much appreciated.EDIT: Updated, ok now it does call my function. Never mind Edited May 13, 2009 by Khab
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