On Mon, May 20, 2002 at 08:49:56AM -0700, jasonandmissy at cableone.net wrote:
>I am writing a perl script that ftp's the contents of a directory a couple of times a day.  I loaded net::ftp and I can ftp by the exact file name.  How would I ftp the whole directory or is mput supported with any perl module?

Something like this should be sufficient. 

# get a filehandle for the dir where your stuff to put is. A more elegant
# solution might be to use an actual Net::FTP object but I'm too lazy to
# RTFM perldoc Net::FTP to figure out if it gives you those objects.
opendir(FTPPUTDIR, "/place/where/your/shit/is") || die "Dammit: $!"
# loop through the file handle
while ($file = readdir(FTPPUTDIR) {
	# use the subrouting from below that contains the Net::FTP methods you
	# need. I didn't look to hard at the Net::FTP perldoc to see if it had
	# an mput. 
	ftp_put($file);
}
closedir(FTPPUTDIR)

sub ftp_put {
	# Plase the Net::FTP code here
	statements;
	more statements;
}


Even simpler yet is a bash script:
#!/bin/bash
for i in /path/to/shit/* ; do 
	ncftpput $i ftp.anonymous.org:/path/to/put/to
done
-- 
Ben Lutgens				 | http://people.sistina.com/~blutgens/	
System Administrator	 | http://www.sistina.com/
Sistina Software Inc. | 

"I got a wife and kids too but you don't see me out here stealing Imperial
Droids now do ya?"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20020520/1ec66a5f/attachment.pgp