# cp all
rm -rf /Users/laurentgarnier/Work/tmp;
mkdir /Users/laurentgarnier/Work/tmp;
mkdir /Users/laurentgarnier/Work/tmp/HEPVis;
mkdir /Users/laurentgarnier/Work/tmp/OnX;
cd ~/Work/OpenScientist/v13r0/HEPVis/v6r5;
cp -rf * /Users/laurentgarnier/Work/tmp/HEPVis/.;
cd ~/Work/OpenScientist/v13r0/OnX/v16r0;
cp -rf * /Users/laurentgarnier/Work/tmp/OnX/.;
echo "copy all ok"

# nettoyage 
cd /Users/laurentgarnier/Work/tmp;
rm -rf */Dar*;
find . -name '*~' -exec rm {} \; >/Users/laurentgarnier/Work/tmp/rm_tmp;
find . -name 'CVS' -exec rm -rf {} \;>/Users/laurentgarnier/Work/tmp/rm_tmp;
cp -rf HEPVis/* /Users/laurentgarnier/Work/To_SVN/LAL/OpenScientist/HEPVis/.;
cp -rf OnX/* /Users/laurentgarnier/Work/To_SVN/LAL/OpenScientist/OnX/.;
echo "nettoyage ok"


# svn status
cd /Users/laurentgarnier/Work/To_SVN/LAL;
/sw/bin/svn status -u> /Users/laurentgarnier/Work/tmp/svnStatusFile;
cd /Users/laurentgarnier/Work/tmp;
grep '^[M|C|U] ' svnStatusFile > modifsSVN;
echo "svn status ok"


# creation d'un tar
rm tempFiles.tgz
rm -rf backup
mkdir backup
cd /Users/laurentgarnier/Work/To_SVN/LAL;
awk 'system("cp " $3 " /Users/laurentgarnier/Work/tmp/backup/.")' /Users/laurentgarnier/Work/tmp/modifsSVN
cd /Users/laurentgarnier/Work/tmp;
tar -czvf tempFiles.tgz backup;
echo "tar creation ok"

#ftp
sftp garnier@atlas2.lal.in2p3.fr<<!
bin
cd Backup_mac
rm tempFiles_older.tgz
rename tempFiles_old.tgz tempFiles_older.tgz
rename tempFiles.tgz tempFiles_old.tgz                     
put tempFiles.tgz
quit