Implemented the actual deleting part
This commit is contained in:
parent
6b40527e09
commit
4a975b38f1
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
@ -104,8 +105,14 @@ class BackupRotator:
|
|||||||
|
|
||||||
for purge_index in range(purge_count):
|
for purge_index in range(purge_count):
|
||||||
item_to_purge = self.pick_item_to_purge(children)
|
item_to_purge = self.pick_item_to_purge(children)
|
||||||
self.log("Purging item:", item_to_purge)
|
|
||||||
children.remove(item_to_purge)
|
children.remove(item_to_purge)
|
||||||
|
self.log("Purging item:", item_to_purge)
|
||||||
|
if os.path.isfile(item_to_purge):
|
||||||
|
os.remove(item_to_purge)
|
||||||
|
elif os.path.isdir(item_to_purge):
|
||||||
|
shutil.rmtree(item_to_purge)
|
||||||
|
else:
|
||||||
|
raise Exception("Don't know how to remove this item: " + str(item_to_purge))
|
||||||
|
|
||||||
def gather_rotation_candidates(self, path):
|
def gather_rotation_candidates(self, path):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user