Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # datetag.sh
- # Usage: datetag.sh <filename>
- #
- # Will rename a file, and prepend ISODate of the last modified stamp
- # in front of the filename;
- # eg testfile.txt with a last modified timestamp of september 1st, 2018
- # will become 20180901_testfile.txt
- mod_date="$(stat -c %y ${1} | awk '{print $1}')"
- mv ${1} ${mod_date}_${1}
Advertisement
Add Comment
Please, Sign In to add comment