Anonymous user
File size distribution: Difference between revisions
m
→{{header|REXX}}: increased numeric digits to handle extremely large disks, optimized code for reading of the workfile.
m (→{{header|REXX}}: optimized the reading of the workfile.) |
m (→{{header|REXX}}: increased numeric digits to handle extremely large disks, optimized code for reading of the workfile.) |
||
Line 414:
This REXX version works for Microsoft Windows using the '''dir''' subcommand; extra code was added for
<br>older versions of Windows that used suffixes to express big numbers (the size of a file).
<lang rexx>/*REXX program displays a histogram of filesize distribution of a directory structure
numeric digits
parse arg ds . /*obtain optional argument from the CL.*/
parse source . . path . /* " the path of this REXX program.*/
Line 421:
parse var fID fn '.' /* " just the pure filename of pgm.*/
sw=linesize() - 1; if sw<80 then sw=79 /* " terminal width (linesize) - 1.*/
dirOut= fn".OUT" /*
'DIR' ds '/s
call linein 0, 1 /*open output file, point to 1st record*/
maxL=0 /*maximum length of number of records. */
@.=00 /*stemmed array to hold record counts. */
g=0 /*number of good records found (so far)*/
$=0; do while lines(dirOut) \== 0 /*process data. */
_=linein(dirOUT); if left(_, 1)==' ' then iterate /*
parse upper var _ . . sz . /*uppercase suffix*/
if \datatype(sz,'W') then do; #=left(sz, length(sz) - 1) /*SZ has a suffix?*/
if \datatype(#, 'N') then iterate
end
$=$ + sz /*keep a running total for the filesize*/
if sz==0 then L=0 /*handle special case for an empty file*/
|