1 /* exts
.r
, displays all
extensions (+info
) in a directory
*/
2 /* Bill N
. Vlachoudis (c
) May
1996 */
3 if arg(1) = "?" then do
4 say
"syntax: exts [<dir>]"
5 say
"desc: Displays a summary of file extensions in the current directory"
6 say
"author: Bill N. Vlachoudis"
11 if system
== "UNIX" then
12 'ls -l' arg(1) '(stack'
15 /* skip first lines
*/
30 if system
=="UNIX" then
31 parse pull
. . . . size
. . . name
'.' type
.
33 parse pull name type size fdate ftime
36 type
= 'No_EXT' /* file has
'*. ' type of name
*/
39 if type
= "file(s)" then do
45 if type
="<DIR>" then iterate
48 size
= delstr(size
,p
,1)
51 if datatype(size
) ^
= "NUM" then iterate
53 if datatype(size
,'NUM') then do
54 if type
="" then type
="(none)"
55 size
.type
= size
.type
+ size
56 count
.type
= count
.type
+ 1
57 totsize
= totsize
+ size
59 if count
.type
= 1 then exts
= exts type
60 maxtype
= max(maxtype
,length(type
))
64 line
=left("Extensions",maxtype
) " Files" right("Size",10)
67 say
copies('-',length(line
))
68 do i
= 1 to
words(exts
)
70 say
left(type
,maxtype
) format(count
.type
,6) format(size
.type
,10)
73 say
copies('-',length(line
))
74 say
words(exts
) "Extensions, " files
"Files"
75 say
"Total Size =" totsize
"."