Page 1 of 1

Synchronization?

Posted: Mon Oct 23, 2006 12:05 am
by Doogie
Help --- I am totally new to website building and FTP uploading and am having some trouble using the Duck. I am having to re-upload my entire website everytime I want to update. I know that I am probably missing something very simple, a setting or whatnot that allows the host and client to simply mirror and skip uploading files that already exist on my server.

Any advice on this matter will make my life about 1000% easier. Thank you for your advice. Doogie

PS --- if it matters, I am using iWeb for page building and uploading to a 1&1 account. If you need any other information, I will be happy to provide it.

synchronisation

Posted: Tue Oct 24, 2006 10:06 am
by 2xdutch
I use iWeb to. The problem is, if you do it like I do, publish from iWeb to a folder on the disk and then upload to your hosting provider, iWeb always overwrites all files in the folder for your entire web. i.e. not just the changed ones! Thta makes synching looking only at newer file dates impossible.

You can select the files you know you have changed and upl;oad only these "manually" but be carefull if you add or remove pages from your web. Then all the menu bars in all pages change and I find it easier to just reload the entire website.

The annoying bit is that when iWeb publishes to a .Mac account it does know how to upload only the changed files! :???:

Synchronization?

Posted: Wed Oct 25, 2006 11:12 pm
by Doogie
Yeah, I know, and that is probably the biggest fault I see using the iWeb software. I love my Mac, but am not the world's biggest fan of all Apple Apps --- I think that many stink, especially iPhoto. Picasa runs circles around it and it is free.

But back to iWeb, what you are saying is that I am basically screwed. Minimize whole page adds and completely upload my blog when I update then?

Let me ask you this --- is it hard to use a purchased URL, a http://www.xxxxxx.com address and overlay it on a .mac account? I skipped out on the .mac account because publishing there meant a complex name for my site. And with my friends, I want to make it as simple as possible.

Otherwise, I enjoy using iWeb and my friends, even the graphic art type I know is very impressed with the results for someone as inexperienced as me.

Thanks for the reply. Doogie

Synchronization?

Posted: Sun Oct 29, 2006 10:20 pm
by schmoocunn
I had the same problem. With a lot of photos on my website, updating everything was taking forever. So instead, I spent yesterday writing a short bash script to help out.

The idea is to keep two copies of the published website: one which is published to by iWeb and the other which is uploaded to your website (using CyberDuck). The script does the job of updating, but only replaces the files which have been modified, as determined by diff rather than the last modified date. It also deletes files which have been removed.

To run the script, copy the text into a text file and save it as ~/bin/smart_backup Make sure it has executable permissions, and then use it by typing, in my case, "~/bin/smart_backup ~/Sites/iWeb ~/Sites/iWeb_backup" into the Terminal. Here, "iWeb" is the directory I've published to, and "iWeb_backup" is the directory I upload from. You can even use Automator to type that bit for you.

Finally, I should note that this is the first bash script I have written and since I wrote it only yesterday, it hasn't been very well tested and quite possibly contains bugs. Use it at your own risk, and if you do find any problems, please post a reply.

The code:

#!/bin/bash
# Backup the source folder to the destination directory
# Destination directory must exist
# Identical files are NOT copied
# Extra files in the destination directory are deleted

# Check that input are two directories
if [ $# -ne "2" ]
then
echo "Usage: `basename $0` source_dir dest_dir"
exit 65
fi

# Check that directories exist
if [[ ! -d "$1" || ! -d "$2" ]]
then
echo "Both source and destination directories must exist."
exit 66
fi

# Copy new files
ls "$1" |
while read file
do
# Check if it is a directory
if [ -d "$1/$file" ]
then
# Make sure it exists in the destination directory
if [ ! -d "$2/$file" ]
then
echo "Creating directory: $2/$file"
mkdir "$2/$file"
fi
# Backup this directory
echo "Checking directory: $1/$file"
~/bin/smart_backup "$1/$file" "$2/$file"
else
# Check if it exists in the destination directory or if it is identical
if [ ! -f "$2/$file" ]
then
# Copy the file
echo "Copying: $1/$file"
cp -f "$1/$file" "$2/$file"
else
cmp -s "$1/$file" "$2/$file" &> /dev/null
if [ $? -ne 0 ]
then
# Copy the file
echo "Copying: $1/$file"
cp -f "$1/$file" "$2/$file"
fi
fi
fi
done

# Delete any extra files in destination
ls "$2" |
while read file
do
# Check if it exists in source
if [[ ! -f "$1/$file" && ! -d "$1/$file" ]]
then
echo "Removing: $2/$file"
rm -rf "$2/$file"
fi
done

exit 0