bon: show latest modification with time

This commit is contained in:
xeruf 2021-11-25 13:55:44 +01:00
parent 4fe9e9cf64
commit 634b39ed9c
2 changed files with 2 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh -e #!/bin/sh -e
# Displays the latest files in the given directory or pwd # 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

View File

@ -3,6 +3,6 @@
IFS='\n' IFS='\n'
for file for file
do mv --verbose --interactive "$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 done
# stat --format %y "$file" | cut -d' ' -f1 # stat --format %y "$file" | cut -d' ' -f1