45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
/* NetRexx */
|
|
options replace format comments java crossref symbols binary
|
|
|
|
runSample(arg)
|
|
return
|
|
|
|
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
method isExistingFile(fn) public static returns boolean
|
|
ff = File(fn)
|
|
fExists = ff.exists() & ff.isFile()
|
|
return fExists
|
|
|
|
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
method isExistingDirectory(fn) public static returns boolean
|
|
ff = File(fn)
|
|
fExists = ff.exists() & ff.isDirectory()
|
|
return fExists
|
|
|
|
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
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
|
|
if isExistingFile(fn) then ex = 'exists'
|
|
else ex = 'does not exist'
|
|
say 'File '''fn'''' ex
|
|
end
|
|
when 'D' then do
|
|
if isExistingDirectory(fn) then ex = 'exists'
|
|
else ex = 'does not exist'
|
|
say 'Directory '''fn'''' ex
|
|
end
|
|
otherwise do
|
|
if isExistingFile(fn) then ex = 'exists'
|
|
else ex = 'does not exist'
|
|
say 'File '''fn'''' ex
|
|
end
|
|
end
|
|
end
|
|
|
|
return
|