Jump to content

I have a question whit FileFindFirstFile


Go to solution Solved by Subz,

Recommended Posts

Hello!
I am needing help with this. It happens that I want to browse files, but they are in subfolders with different names. My question is how can I examine all the subfolders that are in that folder? I will explain:
I'm just making a plug-in system for some software, and I need to examine the manifest files. The structure of the folders is like this, we are going to start from the main folder of the script.
Plug-ins folder: The folder where plug-ins created by users are stored.
plug-ins\dictionaries subfolder: The folder that contains the files for this plug-in.
Another subfolder, plug-ins\test: a template for making your plug-ins.
And so if you are going to create more future plug-ins there are more subfolders that you don't know the name of.
What I want to do is to analyze, from the plug-ins folder, all the manifests that are in the subfolders. I made this code, and when I put it to the test (in debugging with a script that calls the function with a MSGBox) it returns 0, which means that there is an error finding the files.
By the way, I used wildcards and searched on the internet, for example: Plug-ins\**\information.ini but it doesn't work. I hope you can help me.
I leave the code:
 

Func ScanAddOnInfos()
    $hFiles = FileFindFirstFile(@ScriptDir & "\plug-ins\information.ini")
    If $hFiles = -1 Then Return 0
    Local $sFileName = "", $aResult[]
    While 1
        $aResult[] = FileRead(FileOpen($sFileName, $FO_READ))
        $sFileName = FileFindNextFile($hFiles)
        If @error Then ExitLoop
        Sleep(50)
    WEnd
    Return $aResult
EndFunc

 

Edited by Mateocedillo
Link to post
Share on other sites
On 4/28/2022 at 10:19 PM, Subz said:

Why can't you use _FileListToArrayRec (@ScriptDir & "\Plug-ins", "information.ini", 1, 1, 1, 2) then loop through the results?

Hello,
Thanks for your answer. Yes, it has indeed worked.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...