Jump to content

File size distribution: Difference between revisions

→‎{{header|REXX}}: added support for an alternative comma, added a programming note (before the output section).
m (added a ;Task: section header, added whitespace before the table-of-contents (TOC), separated suggestions and a query from the task's requirements..)
(→‎{{header|REXX}}: added support for an alternative comma, added a programming note (before the output section).)
Line 430:
_=linein(dirOUT); if left(_, 1)==' ' then iterate /*process data. */
parse upper var _ dat tim sz . /*uppercase suffix*/
if pos('/,', datsz) \==0 | pos(":",then tim)sz==0space( translate(sz, then, iterate",ÿ"), 0) /*SZ has commas? /*validate dat&tim*/
if pos\datatype('sz,', szW') \==0 then szdo; #=spaceleft(sz, translatelength(sz,) ,- ","1), 0) /*SZ has commasa suffix? */
if sz=\datatype(# * 1024 **pos(sfx,'KMGTN')/1 then iterate /*computeMeat ¬ truenumeric? val*/
if \datatype(sz,'W') then do; #=left(sz, length(sz) - 1) /*SZ has a suffix?*/
if \datatypesfx=right(#sz,'N' 1) then iterate /*Meatget ¬the numeric?suffix. */
sfxsz= right#*1024**pos(szsfx, 'KMGTPEZYX')/1) /*get thecompute suffix.true val*/
sz=# * 1024 **pos(sfx,'KMGT')/1 /*compute true val*/
end
$=$ + sz /*keep a running total for the filesize*/
Line 468 ⟶ 467:
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _</lang>
This REXX program makes use of &nbsp; '''LINESIZE''' &nbsp; REXX program (or BIF) which is used to determine the screen width (or linesize) of the terminal (console).
<br>The &nbsp; '''LINESIZE.REX''' &nbsp; REXX program is included here &nbsp; ──► &nbsp; [[LINESIZE.REX]].<br>
 
{{out|output|text=&nbsp; when using the default input: &nbsp; (which in this case was the &nbsp; '''C:''' &nbsp; drive.)}}
<pre>
Cookies help us deliver our services. By using our services, you agree to our use of cookies.