Sign in to follow this  
Followers 0
PsaltyDS

_filelisttoarray, Including Subdirectories

3 posts in this topic

I'm making this way too hard - there has got to be an easier way. I'm looking to do the equivelent of the following shell command:

DIR *.txt /s /b

Do I really have to write recursive loops to first list the directories, then search those for more directories, then search the who list for the files? What I want to end up with is an array containing the files including full paths, from all subdirectories. Like the following, only without having to call a CMD shell and use DIR:

#include <array.au3>
#include <file.au3>

Dim $avFileArray

$sShellCmd = "DIR C:\*.txt /S /B > C:\FileList.txt"
RunWait(@ComSpec & " /c " & $sShellCmd, @TempDir)
_FileReadToArray("C:\FileList.txt", $avFileArray)

_ArrayDisplay($avFileArray, "Array of TXT files")

What's the easy, straight forward solution that is whizzing by way over my head right now...? :)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites



Hi,

I don't think so;

Use a UDF like in the "recursive" link in my signature; multiple choices

Best, Randall

Thanks! That's a great list you have there. :(

Looks like it's as bad as it looked originally for trying to do it without Run() calls to the CMD shell. I'm going to move on with w0uter's technique for now, and come back to try some others later when I have more time. Thanks.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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