."\ Master source for filesize manual : /usr/src/local/man/src/filesize.rof .TH FILESIZE P " V1.1 for Prog. V1.0" "Julian Stacey" "Julian Stacey, Vector Systems Ltd" .\" A4 the cludgy way. .pl 29.6c .UC 4 .SH NAME filesize \- Report and exit according to numeric file size comparison. .SH SYNTAX .B filesize [options] size mode file[s] .SH SUMMARY Return a 0 if a .I filesize expression is evaluated as true (0 being compatible with the Unix `No Error' standard return value), or a 1 if the expression evaluates as false, or a 2 if either a syntax error or file error ('stat()') error occurs. .SH OPTIONS .B \-q .br Quiet mode. Does not report results of comparisons, Does still use return code. Does report missing files. .br .B \-i .br Ignore errors (both comparisons and missing files). .br .\" .B \-L .\" JJLATER - NOT YET IMPLEMENTED .\" .br .\" {Same behaviour as ls(1)}: .\" If argument is a symbolic link, list the file or directory the .\" link references rather than the link itself. .\" maybe via ls.c traverse(). .SH DESCRIPTION .I Filesize is used to determine whether a file is larger, smaller or equal to a certain size, signalling compliance via its return status. Typical use is to decide if a binary is small enough to install on a floppy, or to detect over large files. Mode may be any of: >, >=, +, +=, <, <=, -, -=, =, or ==. .br + is treated the same as > ; += is treated the same as >= ; == is treated the same as = . The name and size of filenames that do not comply are printed to stdout. If a name is a symbolic link to an existing file, the size of the file is measured, (not the size of the link, thus you do not need a flag similar to 'L' in man ls). .SH EXAMPLES Example 1 .br A Bourne shell usage such as : .in +4 .nf filesize 1000 >= /usr/adm/wtmp if $result cp /dev/null /usr/adm/wtmp .fi .in -4 should truncate a log file tha's too big. Example 2 .br .ti +4 filesize 20 < jim fred .br In human terms this means : if both jim and fred are greater than 20 bytes return 0, else return 1. .br In pseudo `C' language the expression evaluated and returned is : .ce .nf ! ( ( 20 < size_of(jim) ) && ( 20 < size_of(fred) ) ) .fi Example 3 & 4 .br .ti +4 find . -type f -print | xargs filesize 200000 += .ti +4 find . -type f -exec filesize -q 200000 - {} \\; -exec ls -l {} \\; .br Report all very large files in tree (use when recovering disc space). .in -4 Final Example .br The following is an actual extract from the Makefile for this .I filesize command, try copying it to a file & running it. ( the .I make utility is useful here for displaying return values). .br Note tst.20 & tst.26 are (of course) sizes 20 & 26 bytes respectively. .in +4 .nf ----- .so /usr/share/man/manL/filesize.example ----- .fi .in -4 .in -4 First Example Of Msdos Usage: .in +4 .nf vol a: | grep BOOT > tst filesize 10 \\< tst > nul: if errorlevel 1 echo No BOOT label. .fi .in -4 Second Example Of Msdos Usage: .in +4 .nf filesize 27000 \\> transfer.exe > nul: if errorlevel 1 echo Cant install transfer.exe, not enough space. .fi .in -4 .SH RESTRICTIONS If you wish to use < and > rather than - and + you will probably need to delimit them so your sh/csh/ksh/command.com command interpreter does not consider them redirection meta characters. .I Filesize is not a standard Unix command, it is unique to VSL systems with the Ournix overlay. .SH EXIT CODE Note that the error code only applies to the last in the list of files compared, & does not return an error code as and "And" or "Or" function of error status applying to test of each individual file. .SH BUGS Last upgraded 6/94, not rigorously tested since. .SH HOST OP SYSTEM This utility runs on both Msdos 3.2 & Unix UCB BSD 4.2, & FreeBSD (BSD 4.4). .SH COPYRIGHT Program Copyright Julian H. Stacey, Munich, 23rd October 1988. Document Copyright Julian H. Stacey, Munich, 24th July 1989. .so author.jhs .\ End of file