#156920 - 2006-02-11 08:20 PM
Re: Dir() Help
|
thepip3r
Hey THIS is FUN
   
Registered: 2005-03-02
Posts: 350
|
Yo da man Bryce, here's how I ended up getting it by file extension. Thanx Les, NTDOC, and everyone else who helped as well! You guys all rock!
Code:
Break On $ = SetOption("WrapAtEOL","On")
$root = "%userprofile%\desktop" $ext = "mp3", "avi", "jpg", "gif", "wmv"
$folders = dirplus($root,'/ad /s1') for each $folder in $folders $folder.path ? for each $e in $ext $files = dirplus($folder.path,'/s /a-d /f '+$e) for each $f in $files $folsize = $folsize + $f.size next ? $e + ": " + $folsize $folsize=0 next next
sleep 10
|
|
Top
|
|
|
|
#156921 - 2006-02-11 10:02 PM
Re: Dir() Help
|
thepip3r
Hey THIS is FUN
   
Registered: 2005-03-02
Posts: 350
|
nother question I'm not really understanding as I've stepped through the code and don't see why this is happening..
when i run through the script, the writes to the screen show the information as it should be so I know that my loops are correct BUT when I try to write that information to a file, ONLY the very first extension gets reported.
code: Code:
If $open = 0 $folders = dirplus($root,'/ad /s1') for each $folder in $folders $folder.path ? $ = WriteLine(1,$folder.path+',') for each $e in $ext $files = dirplus($folder.path,'/s /a-d /f '+$e) for each $f in $files $folsize = $folsize + $f.size next $e + ": " + $folsize ? $ = WriteLine(1,0+$folsize+',') $folsize = 0 next $ = WriteLine(1,@CRLF) next Endif
File Output:Quote:
,mp3,avi,jpg,gif,wmv,msi, C:\Documents and Settings\cameron.wilson\Desktop\Fairchild Netlogon,000000 C:\Documents and Settings\cameron.wilson\Desktop\Fairchild Netlogon\kix,000000 C:\Documents and Settings\cameron.wilson\Desktop\KiX,000000 C:\Documents and Settings\cameron.wilson\Desktop\KiX\Archive,000000 C:\Documents and Settings\cameron.wilson\Desktop\Release,000000 C:\Documents and Settings\cameron.wilson\Desktop\test,325728400029017485822464
Screen OutputQuote:
C:\Documents and Settings\cameron.wilson\Desktop\Fairchild Netlogon mp3: avi: 0 jpg: 0 gif: 0 wmv: 0 msi: 0 C:\Documents and Settings\cameron.wilson\Desktop\Fairchild Netlogon\kix mp3: 0 avi: 0 jpg: 0 gif: 0 wmv: 0 msi: 0 C:\Documents and Settings\cameron.wilson\Desktop\KiX mp3: 0 avi: 0 jpg: 0 gif: 0 wmv: 0 msi: 0 C:\Documents and Settings\cameron.wilson\Desktop\KiX\Archive mp3: 0 avi: 0 jpg: 0 gif: 0 wmv: 0 msi: 0 C:\Documents and Settings\cameron.wilson\Desktop\Release mp3: 0 avi: 0 jpg: 0 gif: 0 wmv: 0 msi: 0 C:\Documents and Settings\cameron.wilson\Desktop\test mp3: 3257284 avi: 0 jpg: 0 gif: 0 wmv: 2901748 msi: 5822464 Press any key to exit
** For some reason, it's only writing the mp3 entries into the file and then it stops writing. Any ideas?
Edited by thepip3r (2006-02-11 10:07 PM)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1662 anonymous users online.
|
|
|