From 9bda8c7eb613513be0782187d12ce6b81660e4cf Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 27 Mar 2021 17:38:59 +0100 Subject: [PATCH] better errlog name --- copyparty/sutil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/copyparty/sutil.py b/copyparty/sutil.py index 49785bf0..618a699b 100644 --- a/copyparty/sutil.py +++ b/copyparty/sutil.py @@ -1,6 +1,7 @@ import os import time import tempfile +from datetime import datetime def errdesc(errors): @@ -13,9 +14,12 @@ def errdesc(errors): tf_path = tf.name tf.write("\r\n".join(report).encode("utf-8", "replace")) + dt = datetime.utcfromtimestamp(time.time()) + dt = dt.strftime("%Y-%m%d-%H%M%S") + os.chmod(tf_path, 0o444) return { - "vp": "archive-errors-{}.txt".format(int(time.time())), + "vp": "archive-errors-{}.txt".format(dt), "ap": tf_path, "st": os.stat(tf_path), }