From 7ff917bdcd73f56d74286b1c65d44da807f8c61f Mon Sep 17 00:00:00 2001 From: rasmusvt Date: Mon, 11 Jul 2022 17:38:13 +0200 Subject: [PATCH] Change timestamp to modified instead of creation --- nafuma/auxillary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nafuma/auxillary.py b/nafuma/auxillary.py index 9879a19..96b9ce2 100644 --- a/nafuma/auxillary.py +++ b/nafuma/auxillary.py @@ -127,7 +127,7 @@ def backup_file(filename, backup_dir): # Get a list of all previous backup files with the same basename as well as the creation time for the prev_backup_files = [file for file in os.listdir(backup_dir) if os.path.basename(filename.split('.')[0]) in file] - creation_time = datetime.strptime(time.ctime(os.path.getctime(filename)), '%a %b %d %H:%M:%S %Y').strftime("%Y-%m-%d_%H-%M-%S") + creation_time = datetime.strptime(time.ctime(os.path.getmtime(filename)), '%a %b %d %H:%M:%S %Y').strftime("%Y-%m-%d_%H-%M-%S") ext = '.' + filename.split('.')[-1] dst_basename = creation_time + '_' + filename.split('.')[0] + '_' + f'{len(prev_backup_files)}'.zfill(4) + ext