Jump to content

FileFindFirstFile() FileFindNextFile()


Recommended Posts

I have a script that I want to take all 'files' and write them down into a central file (called AU3Log.txt). The problem lies in searching inside of a sub-directory that was previously found using FindFirst and FindNExt functions. I could only think of using a copy-paste command to copy the script into the sub-folder and have it un from there with an .ini file giving it the directions for writing the log. I could then delete the copied file after it finishes but the problem with this is the obvious massive copying of the script. Is there way way to amke this script work the way that I wanted it to?

The basis for finding the sub-dir is using an array and counting up how many files are in that array. I would then send it into a loop to search those first folders and add any sub-sub-folders that it finds into the list (array).

Even ff you can't help me with this problem but you can help wth my script command usage I would be also thankful.

(This script is being writen to be used as a diagnostic on scripting languages to be entered into a high-school science fair aiming for the State-wide fair.)

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

While $CountB <> $CountA
    $CountB = $CountB + 1
    $First = FileFindFirstFile(@WorkingDir & "\" & $FileList[$CountB][1] & "\" & "*")
    $File = FileFindNextFile($First)
    While NOT @error
        If $File = "0" OR $File = ".." OR $File = "." OR StringInStr("H",FileGetAttrib($File)) <> "0" Then
        ElseIf StringInStr("D",FileGetAttrib($File)) = "0" Then
            FileWrite($Log,$FileList[$CountB][1] & "\" $File & @CRLF); I need this to return the current path before the file...
        Else
            $CountA = $CountA + 1
            ReDim $FileList[$CountA + 1][3]
            $FileList[$CountA][1] = $FileList[$CountB][1] & "\" & $File; I need this to have the $FileList[$CountB][1] & $File 
                            ;for the next call into that folder (the whole point of this loop
        EndIf
        $File = FileFindNextFile($First); I need this to continue searching in $FileList[$CountB][1]
    WEnd
    FileClose($First)
WEnd
FileClose($Log)

That is what I came up with for the second half of the script (after I researched the _FileSearch), but the

$First = FileFindFirstFile(@WorkingDir & "\" & $FileList[$CountB][1] & "\" & "*")
Keeps failing, it is the equal to the (should I say popular?) _FileSearch command. The difference between this script and the usage of the _FileSearch is that I need to find the shortest possible way to do this task, and trying to strip the stacking of variables out of the _FileSearch I get lost constantly. Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Sorry, I found the problem to be when looking up the information on the current file, it did not calculate the directory the file was in. Therefor, it never came out with the right information disableing the ability to sort the file correctly.

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

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