File size distribution: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added support to handle commas within numbers.) |
|||
Line 602: | Line 602: | ||
<br>older versions of Windows that used suffixes to express big numbers (the size of a file), and also versions |
<br>older versions of Windows that used suffixes to express big numbers (the size of a file), and also versions |
||
<br>that used a mixed case for showing the output text. |
<br>that used a mixed case for showing the output text. |
||
Also, some Windows versions of the '''dir''' command insert commas into numbers, so code was added to elide them. |
|||
<lang rexx>/*REXX program displays a histogram of filesize distribution of a directory structure(s)*/ |
<lang rexx>/*REXX program displays a histogram of filesize distribution of a directory structure(s)*/ |
||
numeric digits 30 /*ensure enough decimal digits for a #.*/ |
numeric digits 30 /*ensure enough decimal digits for a #.*/ |
||
Line 616: | Line 618: | ||
do while lines(work)\==0; _= linein(work) /*process the data in the DIR work file*/ |
do while lines(work)\==0; _= linein(work) /*process the data in the DIR work file*/ |
||
if left(_, 1)==' ' then iterate /*Is the record not legitimate? Skip. */ |
if left(_, 1)==' ' then iterate /*Is the record not legitimate? Skip. */ |
||
parse upper var _ . . sz . |
parse upper var _ . . sz . /*uppercase the suffix (if any). */ |
||
sz= space( translate(sz, , ','), 0) /*remove any commas if present in the #*/ |
|||
if \datatype(sz,'W') then do; #= left(sz, length(sz) - 1) /*SZ has a suffix?*/ |
if \datatype(sz,'W') then do; #= left(sz, length(sz) - 1) /*SZ has a suffix?*/ |
||
if \datatype(#,'N') then iterate /*Meat ¬ numeric? */ |
if \datatype(#,'N') then iterate /*Meat ¬ numeric? */ |