From 3e6b47cfe3ee9e818b52b1b7af29559c9e609092 Mon Sep 17 00:00:00 2001
From: Sergey Matveev <stargrave@stargrave.org>
Date: Sat, 19 Feb 2022 12:15:14 +0300
Subject: [PATCH] Sortable date in filenames

---
 cmd/download-encs.zsh  | 2 +-
 cmd/download-warcs.zsh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmd/download-encs.zsh b/cmd/download-encs.zsh
index 81ac0a6..11a1ee8 100755
--- a/cmd/download-encs.zsh
+++ b/cmd/download-encs.zsh
@@ -15,7 +15,7 @@ for new (new/*(N)) {
         [[ $cols[1] = "X-Enclosure:" ]] || continue
         url=$cols[2]
         [[ -n "$url" ]]
-        fn=$(url-to-filename $url)-$(strftime %Y%m%d-%H%M%S)
+        fn=$(strftime %Y%m%d-%H%M%S)-$(url-to-filename $url)
         wget --output-document=$dst/$fn $url 2>&2 2>enc.log
         print $dst/$fn
     done < $new
diff --git a/cmd/download-warcs.zsh b/cmd/download-warcs.zsh
index 0198ca2..30d8202 100755
--- a/cmd/download-warcs.zsh
+++ b/cmd/download-warcs.zsh
@@ -28,7 +28,7 @@ for new (new/*(N)) {
             trap "rm -f $tmp" HUP PIPE INT QUIT TERM EXIT
             wget_opts=(--output-document=$tmp $wget_opts)
         }
-        fn=$(url-to-filename $url)-$(strftime %Y%m%d-%H%M%S)
+        fn=$(strftime %Y%m%d-%H%M%S)-$(url-to-filename $url)
         wget $wget_opts --output-file=warcs.log --warc-file=$dst/$fn $url
         print $dst/$fn.warc
     done < $new
-- 
2.51.0