upload.pl
This rather dumb little script is one I wrote to simply synchronise a local directory with one stored on an ftp server. I used it to update my site for ages, which sucked a bit as I never got around to fixing the bug that prevents it from actually deleting dead files. Still, it does perform it's primary function, which is to discover which files have changed and upload only them.
Easy, just create a directory on the FTP server to upload into and a directory on your local machine to upload from. Put the files you want to mirror in the local directory and run the script - the FTP directory will change into a carbon copy of the local one. When you next run the script, only changes are uploaded - this involves deleting any directories and files that are no longer on the local machine, creating new directories and uploading new and changed files.
| Usage |
This script will delete any files on the FTP server that do not exist on the local host. If you are just trying the script out, create an empty directory on the FTP server to upload into. Make sure you type the command line right if there are vital files around! Also note that the behaviour in the presence of symlinks (on the FTP server or the local host) is currently undefined.
(Er, make that 'might delete any...'. It never does for me, but it's *supposed* to).