Benny69Benny69 Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
thepip3r, i think the reason that you are only getting the dir and no files to display is because of this switch /ad, remove that switch so the line appears as: Code:
benny69: yes that was an oversight on my part. taking that out DOES display the files. the reason it was there is because i was originally just wanting the directories so I could run the *.ext search on them. thank you for pointing that out. I'll work with my script from there as Jooel's still returns a blank screen and he wrote it without the /ad switch.
Crap, I just realized why I wanted to do the multiple loops Jooel since you were the one asking why I was still using Dir(). I wanted to script to work like this: start at a root directory, get all sub directories from the root and run a search on *.ext for each extension in my array so I could do a file size check on each one and write the results of the number and size of each file extension at each level of subdirectory. Does that make sense?
NTDOCNTDOC Administrator
Registered: 2000-07-28
Posts: 11628
Loc: CA
Well I'm not sure exactly why as I would think the UBound Redim Preserve would handle it but the folder path appears to be an issue for me when testing with %USERPROFILE% I get: "ERROR : Error in expression: this type of array not supported in expressions.!"
Doing an If check seems to fix it. I'm sure Jooel or Bryce may be able to determine why but I don't have anymore time to work on it.
Code:
If $Path $PathSizes[AScan($Paths,$Path)] = $PathSizes[AScan($Paths,$Path)] + $File.Size EndIf
richie, doc said, he got rid of the error without the if'fing too. if he placed "? $path" where the if stands now, the errors were not happening.
oh, haven't seen his test codes, but this was his resolution yesterday in IM conversation.
the bug comment was a merely a joke, but we all must have had those times with kixtart when there seems to be no explanation for the events taking place.
you have a folder with subfolders in it. and you want the size of the number of files in each subfolder of a given file type/types??
Code:
$root = "%userprofile%\desktop\temp" $folders = dirplus($root,'/ad /s1') for each $folder in $folders $files = dirplus($folder.path,'/s /a-d /f mp3 avi jpg gif wmv') for each $f in $files $folsize = $folsize + $f.size next ? $folsize " " $folder.path $folsize=0 next
Bryce: .size and .path are methods of your variables right? is there anyway to return the extension as well so I can count the sizes for each extension?
those are FSO object's and i dont think that there is a file extension object... I think that there is a .filetype but will not give you what you want.