File size distribution: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added a summary (totals).)
m (→‎{{header|REXX}}: added commas to allow ginormous numbers to be read easier, add output from a non-typical "data" drive.)
Line 436: Line 436:


if g==0 then do; say 'file not found: ' ds; exit 13; end
if g==0 then do; say 'file not found: ' ds; exit 13; end
say ' record size range count '
say ' record size range count '
hdr= '══════════════════ ═══════ '; say hdr; lenHdr= length(hdr)
hdr= '══════════════════ ═════════ '; say hdr; lenHdr= length(hdr)
mC=0 /*mC: the maximum count for any range.*/
mC=0 /*mC: the maximum count for any range.*/
do t=1 to 2 /*T==1 is used to find the max count.*/
do t=1 to 2 /*T==1 is used to find the max count.*/
do k=0 to maxL; mC=max(mC, @.k); if t==1 then iterate
do k=0 to maxL; mC=max(mC, @.k); if t==1 then iterate
select
select
when k==0 then y= ' zero '
when k==0 then y= ' zero '
when k==1 then y= ' 1 ──► 9 '
when k==1 then y= ' 1 ──► 9 '
when k==2 then y= ' 10 ──► 99 '
when k==2 then y= ' 10 ──► 99 '
when k==3 then y= ' 100 ──► 999 '
when k==3 then y= ' 100 ──► 999 '
when k==4 then y= ' 1000 ──► 9999 '
when k==4 then y= ' 1000 ──► 9999 '
otherwise y= '10^'left(k-1,2) "──► 10^"left(k,2) '-1'
otherwise y= '10^'left(k-1,2) "──► 10^"left(k,2) '-1'
end /*select*/
end /*select*/
say y || right(@.k, 8) copies('─', max(1, (@.k / mC * sw % 1) - lenHdr) )
say y || right(commas(@.k), 10) copies('─', max(1, (@.k / mC * sw % 1) - lenHdr) )
end /*k*/
end /*k*/
end /*y*/
end /*y*/
say
say
'ERASE' dirOut /*perform clean─up (erase a work file).*/
'ERASE' dirOut /*perform clean─up (erase a work file).*/
say g ' files detected,' $ " total bytes." /*stick a fork in it, we're all done. */</lang>
say commas(g) ' files detected,' commas($) " total bytes."
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _</lang>
{{out|output|text=&nbsp; when using the default input: &nbsp; (which in this case was the &nbsp; '''C:''' &nbsp; drive.)}}
{{out|output|text=&nbsp; when using the default input: &nbsp; (which in this case was the &nbsp; '''C:''' &nbsp; drive.)}}
<pre>
<pre>
record size range count
record size range count
══════════════════ ═══════
══════════════════ ═════════
zero 1591
zero 1,591
1 ──► 9 207 ─
1 ──► 9 207 ─
10 ──► 99 2023
10 ──► 99 2,024
100 ──► 999 5473
100 ──► 999 5,472
1000 ──► 9999 25,215 ──────────────────────────────────────────────────────────────────
1000 ──► 9999 25207 ────────────────────────────────────────────────────────────────────
10^4 ──► 10^5 -1 14615 ────────────────────────────
10^4 ──► 10^5 -1 14,624 ──────────────────────────
10^5 ──► 10^6 -1 5234
10^5 ──► 10^6 -1 5,234
10^6 ──► 10^7 -1 1017
10^6 ──► 10^7 -1 1,017
10^7 ──► 10^8 -1 151 ─
10^7 ──► 10^8 -1 151 ─
10^8 ──► 10^9 -1 3 ─
10^8 ──► 10^9 -1 3 ─
10^9 ──► 10^10 -1 1 ─
10^9 ──► 10^10 -1 1 ─


55537 files detected, 12656297888 total bytes.
55,539 files detected, 12,656,593,862 total bytes.
</pre>

{{out|output|text=&nbsp; when using the (my) &nbsp; '''K:''' &nbsp; drive:}}
<pre>
record size range count
══════════════════ ═════════
zero 30 ─
1 ──► 9 131 ─
10 ──► 99 821 ─
100 ──► 999 3,866 ────────────────────────
1000 ──► 9999 5,962 ─────────────────────────────────────────────────────
10^4 ──► 10^5 -1 6,876 ──────────────────────────────────────────────────────────────────
10^5 ──► 10^6 -1 2,454 ────
10^6 ──► 10^7 -1 239 ─
10^7 ──► 10^8 -1 6 ─

20,385 files detected, 1,625,509,222 total bytes.
</pre>
</pre>