Anonymous user
File size distribution: Difference between revisions
m
→{{header|REXX}}: made the output more consistant looking, added whitespace to the output, used a more idiomatic programming style..
m (→{{header|REXX}}: changed wording in the output section comments.) |
m (→{{header|REXX}}: made the output more consistant looking, added whitespace to the output, used a more idiomatic programming style..) |
||
Line 420:
fID=substr(path, 1 + lastpos('\', path) ) /* " the filename and the filetype.*/
parse var fID fn '.' /* " just the pure filename of pgm.*/
sw=max(79, linesize() - 1
dirOut= fn".OUT"
'DIR' ds '/s /-c /a-d >' dirOut /*do (DOS) DIR cmd for a data structure*/
call linein 0, 1 /*open output file, point to 1st record*/
maxL=0; @.=00; g=0 /*max len size; log array; # good
_=linein(dirOUT); if left(_, 1)==' ' then iterate /*Not legit? Skip.*/
parse upper var _ . . sz . /*uppercase suffix*/
Line 438 ⟶ 437:
else L=length(sz) /*obtain the length of filesize number.*/
g=g + 1 /*bump the counter of # of good records*/
maxL=max(L, maxL) /*
@.L=@.L + 1 /*bump counter of
end /*j*/ /* [↑] categories: split by log ten.*/
if g==0 then do; say 'file not found: ' ds; exit 13; end /*no good records*/
say ' record size range count '
hdr= '══════════════════
mC=0 /*mC: the maximum count for any range.*/
do t=1 to 2
do k=0 to maxL; mC=max(mC, @.k); if t==1 then iterate /*1st pass? */
otherwise
end
say y || right( commas(@.k), 11) copies('─', max(1,
end /*k*/
end /*y*/
say
trace off; 'ERASE' dirOut /*perform clean─up (erase a work file).*/
say commas(g) ' files detected, ' commas($) " total bytes."
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg _; do
This REXX program makes use of '''LINESIZE''' REXX program (or BIF) which is used to determine the screen width (or linesize) of the terminal (console) so as to maximize the width of the histogram.
<br>The '''LINESIZE.REX''' REXX program is included here ──► [[LINESIZE.REX]].<br>
Line 484 ⟶ 479:
10^9 ──► 10^10 -1 1 ─
55,539 files detected, 12,656,593,862 total bytes.
</pre>
Line 501 ⟶ 496:
10^7 ──► 10^8 -1 6 ─
20,385 files detected, 1,625,509,222 total bytes.
</pre>
|