Backing up files

The following script takes a file and appends the current date to it. This is a very useful script for backing up files regularly using crontab. I’m posting it here because it is both very useful and much harder to find online than one would think.


#!/usr/local/bin/bash
TIMESTAMP=$(date +%Y%m%d)
mv /home/bob/bob.dat /home/bob/bob-$TIMESTAMP.dat

Leave a Reply

Your email address will not be published.