I had an idea of very-very easy bacup script that packs ALL of the files in current dir (including the subfulders and with spaces in name), packs them with tar+gz and moves to a directory. I'm using Cywin under WinXP.
But I have a problem with tar. When I do in a single line
"tar -rf "backup.tar" "somefile1.txt"; "tar -rf "backup.tar" "somefile2.txt";
It says that I need -M for multiple archives (?).
That's my code:
#!/bin/sh
BackUpDir="/cygdrive/D/Backup5"
if ([ $1 ]) then
BackUpDir=$1
fi
if ([ ! -d $BackUpDir ]) then
mkdir -pv $BackUpDir
fi
ArchiveName="$BackUpDir/"`date +"%d.%m.%y(%H.%M)"``dirs | sed 's!^\(/\?.*\)*/\(.*\)$!\2!g'`".tar"
PackCommand=`find -type f -regex ^.*$ | sed 's!^\(.*\)$!tar -M -rf \"__tmp.tar\" \"\1\"'!g`
$PackCommand
rm "__tmp.tar" $ArchiveName
gzip $ArchiveName