Skip to content

Instantly share code, notes, and snippets.

@BlueSkyDetector
Created May 7, 2011 09:38
Show Gist options
  • Save BlueSkyDetector/960364 to your computer and use it in GitHub Desktop.
Save BlueSkyDetector/960364 to your computer and use it in GitHub Desktop.
> cscript //Nologo du.js "C:\test_dir"
function getDirectorySize(path) {
var fd = new ActiveXObject("Scripting.FileSystemObject");
var d;
try {
d = fd.GetFolder(path);
return d.Size;
} catch(e) {
return -1;
}
}
var arg = WScript.arguments;
if (arg.length!=1) {
WScript.echo(-1);
} else {
WScript.echo(getDirectorySize(arg(0)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment