Skip to content

Commit d5e2bb8

Browse files
committed
1 parent cdc3fe0 commit d5e2bb8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

files.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,26 @@ creates the directories if they do not exist:
8383

8484
This may create `foo`, `bar` and `baz`. Don't forget the trailing slash.
8585

86+
### Deleting directories
87+
88+
Use `uiop:delete-directory-tree` with a pathname (`#p`), a trailing slash and the `:validate` key:
89+
90+
~~~lisp
91+
;; mkdir dirtest
92+
(uiop:delete-directory-tree #p"dirtest/" :validate t)
93+
~~~
94+
95+
You can use `pathname` around a string that designates a directory:
96+
97+
~~~lisp
98+
(defun rmdir (path)
99+
(uiop:delete-directory-tree (pathname path) :validate t))
100+
~~~
101+
102+
UIOP also has `delete-empty-directory`
103+
104+
[cl-fad][cl-fad] has `(fad:delete-directory-and-files "dirtest")`.
105+
86106

87107
### Opening a file
88108

@@ -592,3 +612,5 @@ operations.
592612
~~~
593613

594614
See also `(user-homedir-pathname)`.
615+
616+
[cl-fad]: https://edicl.github.io/cl-fad/

0 commit comments

Comments
 (0)