RosettaCodeData/Task/File-size/NetRexx/file-size.netrexx

35 lines
817 B
Plaintext

/* NetRexx */
options replace format comments java symbols binary
runSample(arg)
return
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
method fileSize(fn) public static returns double
ff = File(fn)
fSize = ff.length()
return fSize
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
parse arg files
if files = '' then files = 'input.txt F docs D /input.txt F /docs D'
loop while files.length > 0
parse files fn ft files
select case(ft.upper())
when 'F' then do
ft = 'File'
end
when 'D' then do
ft = 'Directory'
end
otherwise do
ft = 'File'
end
end
sz = fileSize(fn)
say ft ''''fn'''' sz 'bytes.'
end
return