Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Rebol Programming/delete

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

USAGE: DELETE target /any DESCRIPTION: Deletes the specified file(s). DELETE is a function value. ARGUMENTS target -- the file to delete (Type: file url) REFINEMENTS /any -- allow wild cards (SPECIAL ATTRIBUTES) catch SOURCE CODE delete: func [ "Deletes the specified file(s)." [catch] target [file! url!] "the file to delete" /any "allow wild cards" /local p dir blk file ret err ][ dir: throw-on-error [open first p: split-path clean-path target] error? set/any 'err try [ either any [ blk: copy dir foreach file blk [ ret: find/match/any file second p if none? ret [ret: file] either tail? ret [ remove dir ] [ dir: next dir ] ] ] [ blk: copy dir either not none? blk: find blk second p [ remove skip dir (index? blk) - 1 ] [ make error! reduce ['access 'no-delete target] ] ] ] attempt [close dir] either error? get/any 'err [throw err] [get/any 'err] ]