Rebol Programming/delete-dir

USAGE:

edit
DELETE-DIR dir 

DESCRIPTION:

edit

Deletes a directory including all files and subdirectories.

DELETE-DIR is a function value.

ARGUMENTS

edit
  • dir -- (Type: file url)

SOURCE CODE

edit
delete-dir: func [
    {Deletes a directory including all files and subdirectories.} 
    dir [file! url!] 
    /local files
][
    if all [
        dir? dir 
        dir: dirize dir 
        attempt [files: load dir]
    ] [
        foreach file files [delete-dir dir/:file]
    ] 
    attempt [delete dir]
]