# 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/OpenScientist/HEPVis;
/sw/bin/svn status -u> /Users/laurentgarnier/Work/tmp/svnHEPVisStatusFile;
cd /Users/laurentgarnier/Work/To_SVN/LAL/OpenScientist/OnX;
/sw/bin/svn status -u> /Users/laurentgarnier/Work/tmp/svnOnXStatusFile;
cd /Users/laurentgarnier/Work/tmp;
grep '^[M|C|U] ' svnHEPVisStatusFile > modifsHEPVisSVN;
grep '^[M|C|U] ' svnOnXStatusFile > modifsOnXSVN;
echo "svn status ok"


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

#ftp
ftp -n nfsserv.lal.in2p3.fr<<!
user garnier crehio21  
bin
cd Backup_mac
rename tempFiles.tgz tempFiles_older.tgz
rename tempFiles.tgz tempFiles_old.tgz                     
put tempFiles.tgz
quit