CheckSize
Purpose
CheckSize determines if a file's size fits a comparison provided by parameters and returns an ERROR_LEVEL, which
may be used and act upon in batch files.
Download
CheckSize
Installation
None. Download the ZIP file, extract the included executable and run it.
Please note: this is a console application. You should run it from a command prompt.
Use case(s)
-
-
Automated file size detection e.g. for size restrictions.
Syntax
CheckSize /f=<file> /s=<size> /c=<compare argument>
Parameters:
-
/f = file to test, including full path
-
/s = size to compare against, the following units are supported:
-
<omitted> - bytes
-
kb - kilobytes (1kb = 1024 bytes)
-
mb - megabytes (1mb = 1024 kb)
-
gb - gigabytes (1gb = 1024 mb)
-
tb - terrabytes (1tb = 1024 gb)
-
/c = comparison operator to use, where the following numbers are allowed:
-
-2 = lesser than
-
-1 = lesser than or equal to
-
0 = equal to
-
1 = greater than or equal to
-
2 = greater than
Examples
CheckSize /f=c:\users\Me\ntuser.dat /s=1000000 /c=1
Determine if the size of the file c:\users\Me\ntuser.dat is greater than 1 million bytes.
CheckSize /f=c:\users\Me\Documents\MyDoc.txt /s=512mb /c=-2
Determine if the size of the file c:\users\Me\Documents\MyDoc.txt is lesser than or equal to 512 megabytes.
Source code
The PowerBASIC source code is available at Github
Known issues / limitations
Version
-
1.0.3 - May 2017
-
Compiler glitch workaround.
-
1.0.1 - February 2017
-
Up'd the version number to reflect the code refactoring for publishing on Github.
The functionality hasn't changed.
-
1.0 - September 2012