RosettaCodeData/Task/Delete-a-file/NetRexx/delete-a-file.netrexx
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

35 lines
901 B
Text

/* NetRexx */
options replace format comments java crossref symbols binary
runSample(arg)
return
-- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
method isFileDeleted(fn) public static returns boolean
ff = File(fn)
fDeleted = ff.delete()
return fDeleted
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
if isFileDeleted(fn) then dl = 'deleted'
else dl = 'not deleted'
say ft ''''fn'''' dl
end
return