Handbook
Glossary
delete-tree ( path -- )
Factor handbook
»
Input and output
»
Directory manipulation
»
Directory hierarchy manipulation
Next:
copy-tree ( from to -- )
Vocabulary
io
.
directories
Inputs
path
a pathname string
Outputs
None
Word description
Deletes a file or directory, recursing into subdirectories.
Errors
Throws an error if the deletion fails.
Warning
Misuse of this word can lead to catastrophic data loss.
Definition
USING:
io.files.info
kernel
sequences
;
IN:
io.directories
:
delete-tree
( path -- )
dup
link-info
directory?
[
[
[
[
delete-tree
]
each
]
with-directory-files
]
[
delete-directory
]
bi
]
[
delete-file
]
if
;