Sign in to follow this  
Followers 0
flyingboz

Cmdline Parsing For Wildcards

3 posts in this topic

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,

:whistle: 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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks for the suggestion. Using FFFF/FFNF along w/ FileGetAttrib to process subdirs if necessary looks like it's going to work great! :whistle: AutoIT ROCKS!!!


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0