#!/bin/bash # # datetag.sh # Usage: datetag.sh # # 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}