thanks you guys, this script helped me a lot!
but today I found out that it can't process spaces in file names properly so I modified it a bit using the advise from here:
Unixjunkie Blog: Handling Filenames With Spaces
this script seems to process such files properly (although I didn't test it too much):
Code:
#!/bin/bash
# setup folders for our different stages
DIST=/var/www/localhost/htdocs/dist/
DIST_OLD=/var/www/localhost/htdocs/dist_old/
DIST_UPGRADE=/var/www/localhost/htdocs/dist_upgrade/
cd $DIST
find . -type f | while read filename
do
if [ ! -f "$DIST_OLD$filename" ]; then
cp --parents "$filename" $DIST_UPGRADE
continue
fi
diff "$filename" "$DIST_OLD$filename" > /dev/null
if [[ "$?" == "1" ]]; then
# File exists but is different so copy changed file
cp --parents $filename $DIST_UPGRADE
fi
done
cheers!