#-------------------------------------------------------------------------------
# File: dirtoget.eps
# Description: Does a dir; the only thing different is the name
#
#-------------------------------------------------------------------------------

bool $badParams = false;

string $args="";
string $arg;

int $i=1;
while ($i < sizeof($argv)) {
#	$arg=split(" ", $argv[$i]);
	$arg=$argv[$i];
#	ifnot ($arg == $argv[$i]) {
#		$arg="\"$argv[$i]\"";
#	}
# TODO: when split works again, go back to being smart with quotes
	if ($args == "") {
		$args="\"$arg\"";
	} else {
		$args="$args \"$arg\"";
	}
	$i++;
}


bool $success = _FileExists($args, "")
@record on;
'dir $args`;
@record off;

if ($success) {
	bool $isdir=GetCmdData("isdir");
	SetCmdData(bool,"isdir",$isdir);
	int $size=GetCmdData("size");
	SetCmdData(int,"size",$size);
} else {
	SetCmdData(bool,"isdir",false);
	SetCmdData(int,"size",0);
}

return $success;