Jump to content

Easiest way to retrieve list of directories in a directory


Recommended Posts

I would like to get a list of directories from a certain directory; and get a list of results into an array or something of that sort.

At the absolute apex of convenience, it would be nice if I could only include directories in this array that contained a particular file inside of them; e.g, only the names of directories that happen to contain a readme.txt.

Can someone give me a hint of where to start looking?

Link to comment
Share on other sites

#Include <File.au3>
#Include <Array.au3>
$inputFile = InputBox("File name", "Input file name you would like to search for", "Readme.txt")
$location = fileselectfolder("select folder to search desired file name", "")
$FileList=_FileListToArray($location, "*", 2)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
dim $avArray[1]
for $i = 1 to $FileList[0]
    if FileExists($location & $FileList[$i] & "\" & $inputFile)=1 then _ArrayAdd($avArray, $FileList[$i])
Next
_ArrayDisplay($avArray,"Following folders contain " & $inputFile & " file")

Edited by sandin
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...