Author: FiberOPtics -- mirc.fiberoptics@gmail.com
Usage: $foldersize(folderpath [, bkmgt3])[.suf]
Purpose: Returns the size of a folder or drive, including subfolders.
Since the snippet uses COM, it is much faster than the $findfile
equivalents out there, especially on huge folders with several
hundreds of mega/gigabytes.
You can specify a second parameter b,k,m,g,t or 3, which are the
parameters from the built-in $bytes identifier, to format the result. The default output is in bytes, without commas. You can specify the .suf property, which adds the suffix of the chosen format, like B, MB, GB etc.
Requires:
mIRC 6.14 because the dispatch bug was only fixed there
Windows 95/98/NT4.0 + Internetexplorer 4.0
Windows 2k/XP/2k3
Examples:
$foldersize(c:\program files)
$foldersize(c:\mp3,g).suf
$foldersize(d:\,g)
alias foldersize {
var %e = return $+($chr(3),$color(info),$,foldersize:), %size
if (!$isid) return
if ($version < 6.14) %e this snippet requires atleast mIRC version 6.14
if (!$isdir($$1)) %e no such folder $1
if ($0 > 1) && (!$istok(b k m g t 3,$2,32)) %e Incorrect parameter.
if ($prop) && ($prop != suf) %e property can only be suf, to format the number
if ($regex(fsize,$1,/^[a-z]:[\57\134]*$/i)) %size = $disk($1).size
else {
var %objFso = a $+ $ticks, %objFolder = b $+ $ticks
.comopen %objFso Scripting.FileSystemObject
if ($comerr) %e error opening FSO object
.comclose %objFso $com(%objFso,GetFolder,1,bstr*,$1,dispatch* %objFolder)
if ($com(%objFolder)) {
!.echo -q $com(%objFolder,Size,2)
%size = $com(%objFolder).result
.comclose %objFolder
}
}
return $iif($2,$bytes(%size,$2). [ $+ [ $prop ] ],%size)
}
FiberOPtics that\'s normal around here. People tend to look at \'functionality\' rather than code-wise (in your case overall very proffesional looking), meaning that if somebody who doesnt know what it does, and hence doesnt find it usefull, gives a low score.
Well thats how it nearly always goes around here. Anyway nice to see you moving over from mircscripts.org to hawkee. Good coder