Skip to content

Commit 69cb3cd

Browse files
committed
Bug #1343671: clarify docs for os.removedirs
1 parent c1d2f7b commit 69cb3cd

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Doc/lib/libos.tex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -931,11 +931,15 @@ \subsection{Files and Directories \label{os-file-dir}}
931931
\index{directory!deleting}
932932
Removes directories recursively. Works like
933933
\function{rmdir()} except that, if the leaf directory is
934-
successfully removed, directories corresponding to rightmost path
935-
segments will be pruned way until either the whole path is consumed or
936-
an error is raised (which is ignored, because it generally means that
937-
a parent directory is not empty). Throws an \exception{error}
938-
exception if the leaf directory could not be successfully removed.
934+
successfully removed, \function{removedirs()}
935+
tries to successively remove every parent directory mentioned in
936+
\var{path} until an error is raised (which is ignored, because
937+
it generally means that a parent directory is not empty).
938+
For example, \samp{os.removedirs('foo/bar/baz')} will first remove
939+
the directory \samp{'foo/bar/baz'}, and then remove \samp{'foo/bar'}
940+
and \samp{'foo'} if they are empty.
941+
Raises \exception{OSError} if the leaf directory could not be
942+
successfully removed.
939943
\versionadded{1.5.2}
940944
\end{funcdesc}
941945

0 commit comments

Comments
 (0)