flyingboz Posted February 19, 2004 Share Posted February 19, 2004 Hi folks! Been working on a commandline parse utility, and want it to be able to handle wildcards, i.e. program inputfiles.* I need to (at least) parse the cmdline[] var find the files that match, using ? and * correctly loop through each file performing operations in program Code snippets / samples / suggestions on approach welcome. I've got the code working for a specific file, but would like to have a generic executable that could a) be used as a standalone utility and, be utilized as a piped or batched app. I have viewed w/ interest the FileFindFirstFile / FileFindNextFile commands -- would they be a recommended basis for what I am describing? Thanks in advance! Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 19, 2004 Developers Share Posted February 19, 2004 (edited) I have viewed w/ interest the FileFindFirstFile / FileFindNextFile commands -- would they be a recommended basis for what I am describing?FileFindFirstFile / FileFindNextFile should work fine and you can use the example in the helpfile. When you require to also search the subdirectories you could use something like the below script. ; this does a DIR of the current and subdirectories... and sorts the filenames runwait('cmd /c Dir "' & $CmdLine[1] & '" /s /b /x /ON > files.txt',@scriptdir,@sw_hide) $ifile = FileOpen("files.txt", 0) ; Check if file opened for reading OK If $ifile = -1 Then MsgBox(0, "Error", "Unable to open: files.txt") Exit EndIf While 1 $Fi_Rec = FileReadLine($iFile) If @error = -1 Then ExitLoop ; do what you want to do Wend FileFindFirstFile Edited February 20, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
flyingboz Posted February 20, 2004 Author Share Posted February 20, 2004 Thanks for the suggestion. Using FFFF/FFNF along w/ FileGetAttrib to process subdirs if necessary looks like it's going to work great! AutoIT ROCKS!!! Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. 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