File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -931,11 +931,15 @@ \subsection{Files and Directories \label{os-file-dir}}
931931\index {directory!deleting}
932932Removes 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
You can’t perform that action at this time.
0 commit comments