diff --git a/.local/bin/scripts/cachetag b/.local/bin/scripts/cachetag new file mode 100755 index 0000000..bfabcd5 --- /dev/null +++ b/.local/bin/scripts/cachetag @@ -0,0 +1,5 @@ +#!/bin/sh +echo 'Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by (application name). +# For information about cache directory tags, see: +# https://bford.info/cachedir/'>CACHEDIR.TAG diff --git a/.local/bin/scripts/latest b/.local/bin/scripts/latest new file mode 100755 index 0000000..70605f6 --- /dev/null +++ b/.local/bin/scripts/latest @@ -0,0 +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 diff --git a/.local/bin/scripts/predate b/.local/bin/scripts/predate index 5a1ae75..7a3fa92 100755 --- a/.local/bin/scripts/predate +++ b/.local/bin/scripts/predate @@ -1,5 +1,8 @@ -#!/bin/sh +#!/bin/sh -e # Add the modification date in front of the filename +IFS='\n' for file -do mv --verbose --interactive "$file" "$(stat --format %y "$file" | cut -d' ' -f1)_$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\}\)\?_\?//')" done +# stat --format %y "$file" | cut -d' ' -f1