#!/usr/local/bin/perl # # sendtempfile.pl FTP file uploader # Copyright 2001 Mark Paschal # # See accompanying LICENSE file for software license. # use Net::FTP; # The username and password of your FTP account. my ($username, $password) = ('username', 'password'); # The local directory in which the root of your web site exists. my $localdir = '//D/work/web/web'; # The remote directory in which the root of your web site exists. my $remotedir = '/markpasc/www' # Get the file to upload at. my $filename = shift(@ARGV) || die("No filename specified!\n"); # Divine the directory down from the root. my $pwd = `pwd`; chomp $pwd; die("Must be under $localdir!\n") if $localdir ne substr($pwd, 0, length($localdir)); $pwd = substr($pwd, length($localdir)); my $ftp = Net::FTP->new('ftp.mindspring.com'); $ftp->login($username, $password); $ftp->cwd("$remotedir$pwd"); $ftp->delete($filename); $ftp->put('tempfile', $filename); $ftp->quit(); # Print a nice carriage return for a poor Windows user's batch file. print "\n";