[GoLUG] Quick project directory backups (Re: New additions to my bupsky script)
Omer Zak
w1 at zak.co.il
Wed Jan 15 07:46:33 EST 2025
My quick backup script is based upon:
BKPFNAME=~/backups/`date '+%Y%b%d-%H%M'`-someprojname.tgz
cd /path/to/someprojname
tar zcvf $BKPFNAME --exclude=node_modules --exclude=build .
Major differences:
1. tar-gzipped instead of directory tree copy - less risk of confusion
due to editing files in the wrong directory.
2. do not backup some big fat and autogenerated directories.
On Wed, 2025-01-15 at 02:39 -0500, Steve Litt wrote:
> Hi all,
>
> Sometimes I want to back up the directory I'm working in, but it's
> not
> ready for a git entry. That's when I use bupsky. I've been using it
> since at least as early as 2009. It backs up the current directory
> and
> everything under it, with a timestamp. All I do is type ./bupsky and
> then keep on going, without losing my train of thought.
>
> A bupsky feature I've long wished for is the ability to write a very
> small comment, so when one of these quick backups is important or I
> might need to go back to a specific backup, I can do so.
>
> Tonight I put that feature in bupsky. I'll put the code here, but
> keep in mind there's no warranty and I bear no responsibility for
> the results. Here's the code:
>
> ===========================================================
> #!/bin/ksh
> buptrunk=/scratch/bup
>
> makemsg(){
> msg=""
> us="_"
> while test "$1" != ""; do
> msg="$msg$us$1"
> shift
> done
> }
>
> makemsg "$@"
> curdir=$(pwd | sed -e "s/.*\///")
> bupdir=$buptrunk/$curdir
> now=$(date +%Y%m%d_%H_%M_%S)
> src=../$curdir
> dst=$bupdir/${curdir}_$now$msg
>
> if test ! -d "$bupdir"; then
> mkdir "$bupdir"
> fi
>
> cp -RpL "$src" "$dst"
> echo backup written to "$dst"
>
> ===========================================================
>
> Your $buptrunk will probably be different from mine, so just replace
> it
> with the root of all your intended bupsky backups. Have fun with it.
--
No actual electrons, animals or children were harmed by writing this
E-mail message.
My own blog is at https://tddpirate.zak.co.il/
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization withwhich
I may be affiliated in any way.
WARNING TO SPAMMERS: at https://www.zak.co.il/spamwarning.html
More information about the GoLUG
mailing list