|
| |
.GetDirSizeM
Description
- Displays the size (in Millions of bytes) of the current directory, not including subdirs.
- Saves the value in #DirSizeM
- Saves the previous value of #DirSizeM (if it exists) in #Previous_#DirSizeM
- Sets errorlevel based on the result
| Using this offset, we can easily perform mathematical calculations on values up to 1.776 Petabytes (PB),
1,818 Terabytes (TB) or 1,862,645 Gigabytes (GB), without exceeding the
limits of the native shell scripting environment. |
Syntax
Parameters and Switches
Errorlevels and Output Variables
|
Display to
STDOUT |
|
Value of
#DirSizeM |
|
Error
Level |
|
Description of
Result |
|
0 |
|
Actual Bytes
(in Millions) |
|
0 |
|
Exactly 0 bytes
found |
|
1 |
|
Actual Bytes
(in Millions) |
|
1 |
|
1 - .999M bytes found
(1 byte to ~.95MB) |
|
1
to
999 |
|
Actual Bytes
(in Millions) |
|
2 |
|
1M - 999M
bytes found (~.95MB to ~954MB) |
|
1000
to
999999 |
|
Actual Bytes
(in Millions) |
|
3 |
|
1000M - 999999M
bytes found (~.93GB to ~931GB) |
|
1000000
to
999999999 |
|
Actual Bytes
(in Millions) |
|
123 |
|
1000000M - 999999999M
bytes found (~.91TB to ~909TB) |
Examples, Notes and Instructions
NT
2K
XP
K3 |
C:\GuardPost>%.GetDirSizeM%
84
C:\GuardPost>ECHO:%Errorlevel%
2
C:\GuardPost>SET #DirSizeM
#DirSizeM=84
C:\GuardPost>D:
D:\>%.GetDirSizeM%
36444
D:\>ECHO:%Errorlevel%
3
D:\>SET #DirSizeM
#DirSizeM=36444
D:\>SET #Previous_#DirSizeM
#Previous_#DirSizeM=84
D:\> |
- Errorlevel can be checked with ifEL[n] Series of Mount/\Commands.
- The output of .GetDirSizeM is obtained by rounding UP the total bytes in the current directory to the next higher whole Million bytes. Using this offset, we can easily perform
mathematical calculations on values up to 1.776 PB (Petabytes), 1,818 TB (Terabytes) or 1,862,645 GB (Gigabytes).
- Byte totals up to 999,999,999,999,999 (999 Trillion bytes, or over 900 Terabytes) can be successfully manipulated using only the builtin commands.
- REMEMBER! The "M" in GetDirSizeM
represents exactly One Million bytes (1,000,000), NOT one Megabyte (1,048,576).
- If the exact count of bytes used is needed, use ".GetDirSize".
- See the !GuardNote called "SETCalc" for further information regarding the range of
calculations possible within the native NT scripting environment.
- All output is in whole Millions of bytes (1,000,000) NOT Megabytes (1,048,576)
- Output is displayed to STDOUT
- To suppress console display, use
%.GetDirSizeM% %.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 |
|
#Free_d |
|
Free space on Drive d (in bytes, where
d is any accessible local or remote drive) |
|
#FreeM_d |
|
Free space on Drive d (in Millions of 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 |
|