#!/usr/bin/perl

# which I could make rdist work with ssh
# but there's no proper installation over there

$PPTHOME = "/home/tchrist/ppt/";
$PPTREMOTE = "www:htdocs/ppt/";

chomp($cwd = `pwd`);

foreach $file (@ARGV) {
    @opts = qw(-C -p);
    unless (-e $file) {
	warn "No file: $file\n";
	next;
    } 
    if (-d _) {
	push @opts, '-r';
    } 
    elsif (!-f _) {
	warn "Not a plain file: $file\n";
	next;
    }
    ($fullpath = $file) =~ s,^(?=[^/]),$cwd/,;
    ($remote = $fullpath) =~ s,^$PPTHOME,$PPTREMOTE,o;

    print "scp @opts $fullpath $remote\n";
    system "scp @opts $fullpath $remote";  # XXX $? 
} 


