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.

ARGUMENTSEdit

  • dir -- (Type: file url)

SOURCE CODEEdit

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]
]
Last modified on 27 October 2012, at 22:13