dotfiles/.local/bin/scripts/predate

9 lines
309 B
Plaintext
Raw Normal View History

2021-11-25 12:20:13 +00:00
#!/bin/sh -e
# Add the modification date in front of the filename
2021-11-25 12:20:13 +00:00
IFS='\n'
for file
2021-11-25 12:20:13 +00:00
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
2021-11-25 12:20:13 +00:00
# stat --format %y "$file" | cut -d' ' -f1