Sign in to follow this  
Followers 0
Raestlin

Need an AutoIt alternative to DOS...help!

8 posts in this topic

I can perform a simple DOS command like "dir *tub* /s" and it will scan the currently

directory as well as all subdirectories and return a listing of all directories and filenames

that contain the word "tub" in them.

I can't find anything in AutoIt that will do the same thing.

I can always call a DOS command from within AutoIt, but I was hoping someone has

discovered a way to access files from within AutoIt without dumping out to DOS?

I checked out the FileFindFirstFile & FileFindNextFile commands, but they won't work,

because 1) they don't recurse subdirectories and 2) they don't allow two wildcards

on one side of the extension.

Thanks,

~ Chris

Share this post


Link to post
Share on other sites



FileFindFirstFile & FileFindNextFile commands do accept 2 wildcards before the extension, least ways they do on mine.

Search for recursive in scripts and scraps and you will find a script that you can modify.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

i use similar dos commands for similar reasons..... and they work great

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

as far as i have found _FileListToArray() only goes 1 level deep into sub folders

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#include <Constants.au3>

$foo = Run(@ComSpec & " /c dir *tub* /s /b", @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
$output = ""
While 1
    $output &= StdoutRead($foo)
    If @error Then ExitLoop
Wend

$output = StringStripWS($output,3)
$aTubs = StringSplit ($output, @crlf,3)

for $i = 1 to $aTubs[0]
    $curtubfile = $aTubs[$i]
    msgbox(0,"Found tubfile:",$curtubfile)
next

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Share this post


Link to post
Share on other sites

FileFindFirstFile & FileFindNextFile commands do accept 2 wildcards before the extension, least ways they do on mine.

Search for recursive in scripts and scraps and you will find a script that you can modify.

Thanks BigDod.

I searched for recursive and found a pretty good script sample that will work great for what I need. :-)

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