FTP MirrorFTP mirror is a program for mirroring FTP sites using FTP. The distribution is in ftp_mirror-1x0.tgz The algorithmWe assume two sites. The development site which contains the files of interest, and the ftp site where this data is to be stored. The top-level of the development site must contain the file ftp.conf this contains information about the ftp site that is to be used and which files are to be copied, etc. run the command ftp_mirror. This command reads ftp.conf and updates the specified FTP site. The resultant state of the site is stored in a file called ftp_cache.bin. Every time any changes are made to the ftp site the exact state of the site is contained in this cache. ConfigurationCreate a file called ftp.conf in the top-level directory of the development site. Here is an example: {host, "ftp.oocities.com"}. {user, "some_user_name"}. {password, "the password"}. {max_space_allowed, 10000000}. {root, "dir1"}. {include, [".html", ".jpg", ".gif", ".tgz"]}. {exclude_dirs,["tmp", "dustbin"]}. The parameters have the following meaning:
Implementation notesThe algorithm involves computing the following items and then applying the changes:
To compute if a file has changed we first check the time last modified. IF the time last modified has changed we compute the MD5 checksum of the file. If the MD5 checksum has changed then we assume the file has changed. If the date last modified is the same we do not perform any further checks on the file. We only check for equality of the date last modified since we make no assumptions as to the accuracy of the clock. |