Jump to content

FileFindFirstFile, return only directories?


Recommended Posts

Allo again,

I'm working on a little script to clean up my World of Warcraft folders and came across a strange hurdle. What I'm doing is finding the install dir and then making a list of all sub-folders. Only problem is, it will list files aswell as folders. Is there a way to test a path to see if it is a file or folder?

Here's what I've got thus far:

#cs
    WoW Cleaner
    Version 1.0.1
#ce
#include <Array.au3>

Global $sz_AddOns[1] = [0]

If (ProcessExists("World of Warcraft") Or ProcessExists("wow.exe")) Then
    MsgBox(16,"Error","This application can only be run when World of Warcraft is not running.")
    Exit
EndIf

;Find WoW Folder
$sz_GameFolder = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Blizzard Entertainment\World of Warcraft","InstallPath")
If (@error Or $sz_GameFolder == "") Then
    MsgBox(16,"Error","Unable to find World of Warcraft installation.")
    Exit
EndIf
FileChangeDir($sz_GameFolder)

;List and count AddOns
FileChangeDir(@WorkingDir & "\Interface\AddOns")

Local $h_AddOn_List = FileFindFirstFile("*")
If (@error) Then
    MsgBox(16,"Error","Failed to retrieve list of AddOns.")
    Exit
EndIf

While 1
    $f_AddOn = FileFindNextFile($h_AddOn_List)
    If (@error) Then
        ExitLoop
    EndIf
    _ArrayAdd($sz_AddOns,$f_AddOn)
    $sz_AddOns[0] += 1
WEnd

FileClose($h_AddOn_List)

MsgBox(0,"AddOns","AddOns:" & @CRLF & "------------------" & @CRLF & _ArrayToString($sz_AddOns,@CRLF,1,$sz_AddOns[0]) & @CRLF & "Total: " & $sz_AddOns[0])

Let's say there are some text files there, it will list those as well, which I don't want.

Thanx in advance,

CMR

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