Although being a useful option for a programmer (or a writer), it lacks the capability of keeping more backup copies, like a CVS (Concurrent Versions System) where the author can go back in time and find the text file as is was e.g. a month ago (very handy if you want to restore something you have deleted just before one week).
In order to avoid the complexity of a CVS, yet having the option to "travel" back in time, I wrote a small shell script, which I'm running just before my editing sessions. The script looks like this:
#!/bin/bashAll it does is to keep a compressed copy of every file you want to edit in a directory named ".backup", hence I named it "backup2.backup" and I run it as:
datetime=`date +%Y%m%d_%H%M`
bdir=".backup"
mkdir $bdir 2> /dev/null
for a in $*; do
cp -av $a $bdir/$datetime.$a
done
gzip -9 $bdir/$datetime.*
backup2.backup *.php *.htmlIt doesn't check many things, but I'm using it for some time now. Feel free to enhance it as you like it.
Visit The Light of the LAMP blog for more...
Διαβάστε όλο το άρθρο στο "The light of the LAMP" »
Μεταφράστε αυτό το άρθρο (Translate this article) »
