work dizinine kodu açmadan önce temizlemek gerekir.

This commit is contained in:
Barış Metin
2005-06-15 11:09:10 +00:00
parent f25ba861bf
commit 1c21bf289d
+9 -2
View File
@@ -17,8 +17,15 @@ class ArchiveBase(object):
self.fileName = fileName
self.filePath = config.archives_dir() + '/' + self.fileName
self.targetDir = targetDir
if not os.path.exists(self.targetDir):
os.makedirs(self.targetDir)
# first we check if we need to clean-up our working env.
if os.path.exists(self.targetDir):
for root, dirs, files in os.walk(self.targetDir, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
class ArchiveTarFile(ArchiveBase):
def __init__(self, type, fileName, targetDir):