bin/predate: add helper for backups and archives

This commit is contained in:
xeruf 2021-11-23 14:14:24 +01:00
parent 6ee0b19f26
commit 3c34126214
2 changed files with 6 additions and 1 deletions

View File

@ -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 "$@"

5
.local/bin/scripts/predate Executable file
View File

@ -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