mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-09-13 12:10:12 +02:00
build
This commit is contained in:
@@ -629,15 +629,15 @@ if _BACKUP:
|
|||||||
pattern = r"^[0-9]{4}.*" # regex pattern: string starts with 'abc'
|
pattern = r"^[0-9]{4}.*" # regex pattern: string starts with 'abc'
|
||||||
|
|
||||||
if re.match(pattern, f):
|
if re.match(pattern, f):
|
||||||
print("Match!")
|
logging.info("Match!")
|
||||||
dt = datetime.datetime.strptime(f, "%Y-%m-%d_%H-%M-%S")
|
dt = datetime.datetime.strptime(f, "%Y-%m-%d_%H-%M-%S")
|
||||||
epoch_time = int(dt.timestamp())
|
epoch_time = int(dt.timestamp())
|
||||||
now_epoch = int(datetime.datetime.now().timestamp())
|
now_epoch = int(datetime.datetime.now().timestamp())
|
||||||
x = now_epoch - epoch_time
|
x = now_epoch - epoch_time
|
||||||
print(epoch_time) # Output: 45
|
logging.info(epoch_time) # Output: 45
|
||||||
if x > "2592000":
|
if x > "2592000":
|
||||||
dir_path = "{BACKUP_ROOT}/{f}"
|
dir_path = "{BACKUP_ROOT}/{f}"
|
||||||
print(f"removing {dir_path}")
|
logging.info(f"removing {dir_path}")
|
||||||
#shutil.rmtree(dir_path)
|
#shutil.rmtree(dir_path)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user