#!/bin/sh -- # A comment mentioning perl, indented bash's sake. eval 'exec perl -S $0 ${1+"$@"}' if 0; # # Mirrors a set of local files (e.g. website pages & images) to an ftp server. # Place the mirrored dirs and file globs in the %content below. # N.B. each dir has an ftp MDELETE run on it. ALL remote files are destroyed. # See Usage for more information. # Copyright (c) 2001 by Karl J. Runge # #---------------- copy this sort of stuff for a -f file --------------------# $host = 'ftp.somesite.net'; # ftp server $user = 'runge'; # username on server $pass = 'xxxxxxx'; # set to nothing for prompt, # or set to NONE for no passwd $makedirs = 0; # create the directories on server $passive = 1; # use passive ftp not $topdir = 'public_html/mysite/test'; # toplevel remote dir to cd to. # for each dir make a hash entry containing the glob or list of files to upload: $content{'.'} = '*.html *.css'; $content{'images'} = '*.jpg *.gif'; #---------------------------------------------------------------------------# ############################################################################# # No real need to change anything below. Some could be put into -f file ... ############################################################################# chomp($Program = `basename $0`); $FP = "ftp> "; # the ftp(1) cmd prompt. $Mode = 'echo,die'; # waitfor() parameters. $Timeout = 30; # waitfor() timeout. $Debug = 0; $Delete = 1; $Source_File = ''; $Remove_Dirs = 0; $Do_Shell = 0; $Usage = <<"END"; $Program: Mirrors a set of local files (e.g. website pages & images) to an ftp server. Place the mirrored dirs and file globs in the \%content in script (or use -f). N.B. each dir has an ftp MDELETE run on it. ALL remote files are destroyed. Copyright (c) 2001 by Karl J. Runge Usage: $Program Options: -h set ftp server host ($host) -u set ftp server user name ($user) -p set ftp server password -d set toplevel ftp server directory ($topdir) -c create and/or add to the content hash. could be a glob pattern. Overrides content in -f file or script defaults. Overridden by command line items. -k mkdir the directories (e.g. the initial upload) (will create all components of toplevel dir if missing) -R remove all the files and directories (but does not remove top level dir) -t