Subject: Re: Web Site Management
To: Jeff Flowers <jeffrey@jeffreyf.net>
From: paul <pkdb1@attbi.com>
List: netbsd-help
Date: 02/23/2002 22:11:32
This is a multi-part message in MIME format.
--------------020506030809020300030605
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

You could use rsync as someone else suggested or you could write a 
simple mirroring tool: see the attached. I just use it to mirror a 
directory here at my house with my ISP, but it would be trivial to 
move files based on their last modified time. use find2perl and 
the mtime value returned by lstat.

Jeff Flowers wrote:

> I am trying to find a command line tool for NetBSD that would allow me a
> sync a local working copy of my website to the files on my website (remote)
> server via FTP. You know, something that would only move changed files to
> the server.
> 
> Hope I explained my question well enough to be understandable!
> 
> 
> Thanks in advance,
> 
> Jeffrey Flowers
> 
> 
> 


--------------020506030809020300030605
Content-Type: text/plain;
 name="ms-mirror.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ms-mirror.pl"

#!/usr/bin/perl -w

require "find.pl";
&find("/www/");
use Net::FTP;
use Net::Netrc;
$heredir = "/www/";
$theredir = "mywww/";
$ftp = Net::FTP->new("some.server.com", Debug => 0, Passive => 1);
$ftp->login();
$ftp->cwd($theredir);
foreach $name (@filelist) {
	$slash = rindex($name, "/");
	$dir = substr($name, 1, $slash);
	#print "DEBUG: $dir\n";
	$filename = substr($name, $slash+1);
	#print "DEBUG: putting ", $heredir.$name, " to ", $dir.$filename, "\n";
	$ftp->put($heredir.$name, $dir.$filename);
}
$ftp->quit;
exit;


sub wanted {
	$name =~ s|/www/||g;
	push(@filelist,$name) if $name =~ (/^.*\.png|html/);
}


--------------020506030809020300030605--