----^--->
/\

//\\
//The\
/Sy
stem\
////
Guard
\

In the mount of the LORD it shall be seen. Genesis 22:14

GetDirSize

Booming Or Fuming? | MasterCatalog | ntlib (FREE) | NTCmdLib | MtCmds | Scripts | Almost Free | TheGuardBook | Help

 

Types of
.Mount/\Commands

.CrystalClear | .ExactName | .ExitELn | .GetValue | .ifCondition | .ifELn | .IsPattern | .ListValue | .NetValue | .NowValue | .RedirRapids | .ReliableReporting | .RestoreValue | .SetELn | .ValueEcho

.GetValue
Series

  .GetCD | .GetDate | GetDirSize | GetDirSizeM | GetFree | GetFreeM | GetIPAddr | GetIPGateway | GetIPMask | GetLogDate | GetLogTime | GetLogTimeP | GetMac | GetNic | GetOS | GetRole | GetTempFile | GetTime | GetTimeP

.GetDirSize

Description

  1. 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).
  2. Saves the value in #DirSize
  3. Saves the previous value of #DirSize (if it exists) in #Previous_#DirSize
  4. Sets errorlevel based on the result

Syntax

%.GetDirSize%    

Parameters and Switches

none

   

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}


.GetValue
Series

  .GetCD | .GetDate | GetDirSize | GetDirSizeM | GetFree | GetFreeM | GetIPAddr | GetIPGateway | GetIPMask | GetLogDate | GetLogTime | GetLogTimeP | GetMac | GetNic | GetOS | GetRole | GetTempFile | GetTime | GetTimeP

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
/\
//\\
//
The\
/Sy
stem\
////
Guard
\
COME ON UP WITH US!
and
Congratulations On Your Decision
to
RISE ABOVE
THE REST!

^
/
!\
/LIB\

TheSystemGuard.com [Revised: 2007-03-29]
Copyright © 1995-2007, JWC
Computer Communications,
All Rights Reserved, Worldwide.
 Disclaimer       Privacy       About Us       More


Communication Is Business!

We Master It With Knowledge!

^
/
.\
/M^C\