Commit 1948e5fe authored by Balazs Lecz's avatar Balazs Lecz
Browse files

Add RemoveDir utility function

Backported from master, 72087dcd

Signed-off-by: default avatarBalazs Lecz <leczb@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 2fd7f564
......@@ -381,6 +381,24 @@ def RemoveFile(filename):
raise
def RemoveDir(dirname):
"""Remove an empty directory.
Remove a directory, ignoring non-existing ones.
Other errors are passed. This includes the case,
where the directory is not empty, so it can't be removed.
@type dirname: str
@param dirname: the empty directory to be removed
"""
try:
os.rmdir(dirname)
except OSError, err:
if err.errno != errno.ENOENT:
raise
def RenameFile(old, new, mkdir=False, mkdir_mode=0750):
"""Renames a file.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment