bir dizinin içeriğini tümü ile silme işlevini purge_dir() util.py'ye

taşıdım. archive.py dışındaki modüller de kullanabilir.

packagedb.py içerisine eksik olan iki import'u ekledim.
This commit is contained in:
Barış Metin
2005-06-15 13:59:39 +00:00
parent 6fc2b9d5e8
commit e96131b84f
+8
View File
@@ -19,6 +19,14 @@ def check_dir(dir):
check_dir(parent_dir)
os.mkdir(dir)
def purge_dir(top):
"""Remove all content of a directory (top)"""
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
# TODO:
def copy_file():
pass