From 3c341262146af36938eb7d045592869ec1222ab5 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 23 Nov 2021 14:14:24 +0100 Subject: [PATCH] bin/predate: add helper for backups and archives --- .local/bin/scripts/m | 2 +- .local/bin/scripts/predate | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 .local/bin/scripts/predate diff --git a/.local/bin/scripts/m b/.local/bin/scripts/m index 23d0aab..7e61be0 100755 --- a/.local/bin/scripts/m +++ b/.local/bin/scripts/m @@ -6,4 +6,4 @@ for last; do true; done checkaccess -w "$@" || elevate=sudo ! $elevate test -e "$1" && echo "$1 does not exist" && exit 1 $elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac) -$elevate mv --interactive "$@" +$elevate mv --verbose --interactive "$@" diff --git a/.local/bin/scripts/predate b/.local/bin/scripts/predate new file mode 100755 index 0000000..5a1ae75 --- /dev/null +++ b/.local/bin/scripts/predate @@ -0,0 +1,5 @@ +#!/bin/sh +# Add the modification date in front of the filename +for file +do mv --verbose --interactive "$file" "$(stat --format %y "$file" | cut -d' ' -f1)_$file" +done