Add remove() to sysutils
This adds the remove() function, which works a lot like rm -rf - if you remove() a file, it uses os.unlink, and if you remove() a directory it uses shutils.rmtree().
This commit is contained in:
parent
421e4c3a00
commit
1e550f8227
@ -135,3 +135,9 @@ def cpfile(src, dst):
|
|||||||
dst = joinpaths(dst, os.path.basename(src))
|
dst = joinpaths(dst, os.path.basename(src))
|
||||||
|
|
||||||
return dst
|
return dst
|
||||||
|
|
||||||
|
def remove(target):
|
||||||
|
if os.path.isdir(target):
|
||||||
|
shutil.rmtree(target)
|
||||||
|
else:
|
||||||
|
os.unlink(target)
|
||||||
|
Loading…
Reference in New Issue
Block a user