Timestamping files from commandline and Konqueror
Posted in KDE, Linux, Shell on February 5th, 2007 No Comments »
In order to keep multiple versions of a file, I sometimes add a timestamp to the filename. Doing this by hand is tedious and error-prone, but this chore can be automated by a small shell script. /usr/local/bin/timestamp #! /bin/sh for oldname ; do ts=`date +’%Y%m%d%H%M’ –reference=”$oldname”` newname=`echo $oldname | sed -nre “s/^(\\.?)([^\\.]+)(-[[:digit:]]{12})(\\..*)\$/\\1\\2-$ts\\4/p”` if [ -z [...]
