From 634b39ed9cda05c32e371be9b653982d2186d06c Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 25 Nov 2021 13:55:44 +0100 Subject: [PATCH] bon: show latest modification with time --- .local/bin/scripts/latest | 2 +- .local/bin/scripts/predate | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.local/bin/scripts/latest b/.local/bin/scripts/latest index 70605f6..86d77c5 100755 --- a/.local/bin/scripts/latest +++ b/.local/bin/scripts/latest @@ -1,3 +1,3 @@ #!/bin/sh -e # Displays the latest files in the given directory or pwd -find "$1" -maxdepth 4 -type f -printf '%TF %f\n' | sort -r | head +find "${1:-$PWD}" -maxdepth 4 -type f -printf '%.16T+ %P\n' | sort -r | head diff --git a/.local/bin/scripts/predate b/.local/bin/scripts/predate index 7a3fa92..bc13e67 100755 --- a/.local/bin/scripts/predate +++ b/.local/bin/scripts/predate @@ -3,6 +3,6 @@ IFS='\n' for file do mv --verbose --interactive "$file" \ - "$(latest "$file" | head -2 | tail -1 | cut -d' ' -f1)_$(echo "$file" | sed 's/20\([0-9]\{2\}\)-\([0-9]\{2\}\)\(-[0-9]\{2\}\)\?_\?//')" + "$(latest "$file" | head -2 | tail -1 | cut -d'+' -f1)_$(echo "$file" | sed 's/20\([0-9]\{2\}\)-\([0-9]\{2\}\)\(-[0-9]\{2\}\)\?_\?//')" done # stat --format %y "$file" | cut -d' ' -f1