ElSoloMar Posted July 8, 2004 Share Posted July 8, 2004 (edited) Hola! Does any of you guys knows a quick way to get the number of subdirectories/files under a specific parent directory? I already have an implementation with recursion in it but is still a littlel slow. I was thinking of perhaps some system command similar to "dir". Something that will give me this information almost instantly! ElSoloMar Edited August 3, 2004 by ElSoloMar I am running a box with borg technology! The distintiveness of your brand box will be added to the colective ... protection utilities are futile!cha, cha, chachaaaanm! Link to comment Share on other sites More sharing options...
Proof Posted July 8, 2004 Share Posted July 8, 2004 (edited) The - 3 is necessary, because it also counts the directories "." and "..", additionally another nameless something dir (might be the behaviour of FileFindNextFile). Well, it works for me with the "-3", have a look into it on your own I save @error in a variable to be able to use other functions in the loop, that change @error. My code: FileChangeDir("dirname") $handle = FileFindFirstFile("*") $counter = 0 $error = 0 While $error <> 1 $Object = FileFindNextFile($handle) $error = @error MsgBox(0,"",$Object) $counter = $counter+1 WEnd MsgBox(0,"", $counter - 3) PS: FileFindFirstFile: "*" as wildcard for any file or directory FileFindNextFile: Failure: Sets @error to 1 if no more files/directories match the search. Edited July 8, 2004 by Proof Link to comment Share on other sites More sharing options...
Proof Posted July 8, 2004 Share Posted July 8, 2004 (edited) Guess you could also do it with a DOS command. Don't know exactly right know, but check this Link for inspiration (or many other topics). Edited July 8, 2004 by Proof Link to comment Share on other sites More sharing options...
CyberSlug Posted July 8, 2004 Share Posted July 8, 2004 Take a look at JdeB's post here Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now