Change mtime to ctime, so renamed folders and stuff won't ruin things

This commit is contained in:
Mike 2019-02-27 16:47:10 -08:00
parent 77bed65e89
commit 6b40527e09

View File

@ -138,13 +138,13 @@ class BackupRotator:
detection = self.__config["date-detection"] detection = self.__config["date-detection"]
best_item = None best_item = None
best_mtime = None best_ctime = None
for item in items: for item in items:
if detection == "file": if detection == "file":
mtime = os.path.getmtime(item) ctime = os.path.getctime(item)
if best_mtime is None or mtime < best_mtime: if best_ctime is None or ctime < best_ctime:
best_mtime = mtime best_ctime = ctime
best_item = item best_item = item
else: else:
raise Exception("Invalid value for \"date-detection\": " + str(detection)) raise Exception("Invalid value for \"date-detection\": " + str(detection))