Jump to content
Sign in to follow this  
Raestlin

Need an AutoIt alternative to DOS...help!

Recommended Posts

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.



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

#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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...