|
| |
.GetDirSize
Description
- Displays the size, in bytes, of the current directory, not including subdirs (output is adjusted to stay within the limits
allowable by the command shell).
- Saves the value in #DirSize
- Saves the previous value of #DirSize (if it exists) in #Previous_#DirSize
- Sets errorlevel based on the result
Syntax
Parameters and Switches
Errorlevels and Output Variables
|
Display to
STDOUT |
|
Value of
#DirSize |
|
Error
Level |
|
Description of Result |
|
0 |
|
Actual
Bytes |
|
0 |
|
0 bytes found (exactly 0 bytes) |
|
1-999 |
|
Actual
Bytes |
|
1 |
|
1 - 999 bytes found (1 byte to ~.97KB) |
|
1000-999999 |
|
Actual
Bytes |
|
2 |
|
1,000 - 999,999 bytes found (~.97KB
to ~.95MB) |
|
1000000
to
1999999999 |
|
Actual
Bytes |
|
3 |
|
1,000,000 - 1,999,999,999 bytes found
(~.95MB to ~1.86GB) |
|
2000000000 |
|
2000000000 |
|
123 |
|
2,000,000,000 or more bytes found (~1.86GB
or more) |
Examples, Notes and Instructions
NT
2K
XP
K3 |
C:\GuardPost>%.GetDirSize%
1925828608
C:\GuardPost>ECHO:%Errorlevel%
3
C:\GuardPost>SET #DirSize
#DirSize=1925828608
C:\GuardPost>D:
D:\>%.GetDirSize%
11032
D:\>ECHO:%Errorlevel%
2
D:\>SET #DirSize
#DirSize=11032
D:\>SET #Previous_#DirSize
#Previous_#DirSize=1925828608
D:\> |
- Errorlevel can be checked with ifEL[n] Series of Mount/\Commands.
- The output of .GetDirSize is capped at 2 Billion bytes to avoid errors when calculating with the internal
SET command. If the total bytes used is equal to OR GREATER THAN Two Billion bytes, the value of
#DirSize will be 2000000000. To work with larger amounts (up to 900 TB!), use
".GetDirSizeM".
- See the !GuardNote called "SETCalc" for further information regarding the range of
calculations possible within the native NT scripting environment.
- Output is displayed to STDOUT
- To suppress console display, use
%.GetDirSize% %.Quiet%
{errorlevel and output variable(s) will still be available}
Related .Mount/\Commands, #Constants,
$Functions, :Procedures
|
Resource |
|
Short Description |
|
#DirSizeM |
|
Total bytes in current directory, in Millions of bytes (M is 1000000,
NOT MB, which is 1048576) |
|
#FreeM_d |
|
Free space on Drive d (in Millions of bytes, where
d is any accessible local or remote drive) |
|
#Free_d |
|
Free space on Drive d (in bytes, where
d is any accessible local or remote drive) |
|
K
E
Y |
Common Commands |
INTERNAL |
External |
/SWITCH |
Parameter |
Help text |
AddonTool |
|
Mounted Commands |
.Mount/\Command |
CmdShorthand |
#Constant |
$FUNCTION |
:Procedure |
!GuardNote |
|
Operating Systems |
NT/2K/XP/K3 |
NT Only |
NT/2K |
2K Only |
2K/XP |
XP Only |
XP/K3 |
K3 Only |
2K/XP/K3 |
|