Skip to content

Instantly share code, notes, and snippets.

@nagubal
Created May 3, 2009 19:51
Show Gist options
  • Select an option

  • Save nagubal/106132 to your computer and use it in GitHub Desktop.

Select an option

Save nagubal/106132 to your computer and use it in GitHub Desktop.
Backup with cygwin/rsync shell script
#!/bin/sh
# rsync-workspace.sh : Sauvegarde rsync du workspace Eclipse
EXIT_KO=5
srcdir=/cygdrive/d/workspace/
destvol=/cygdrive/e
destdir=$destvol/workspace/
if [ ! -e $destvol ] && [ ! -d $destvol ];
then
echo "Sauvegarde impossible : le disque $destvol n'est pas disponible"
exit $EXIT_KO
fi
if [ ! -e $destdir ] && [ ! -d $destdir ];
then
echo "Création du répertoire de sauvegarde $destdir"
mkdir $destdir
fi
echo "Sauvegarde de $srcdir dans $destdir"
echo
if [ -n "$1" ] && [ "$1" = "test" ];
then
DRY_RUN=--dry-run
fi
rsync -aul $DRY_RUN --progress --stats --exclude-from ~/.exclude_rsync $srcdir $destdir
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment