Michael Pratt wrote: > > Does anyone know how to go and get a file (with wild cards too) and dump > them to a specifed directory on a local machine from the internet. weather > it be ftp or http protocol? If so can I get an example?
#!/usr/bin/perl -w use strict; use Net::FTP; my $local_dir = '/home/Michael'; my $rem_server = 'ftp.someserver.com'; my $rem_dir = '/pub/some_dir/some_other_dir'; my $rem_id = 'anonymous'; my $rem_pw = '[EMAIL PROTECTED]'; my $file_mask = '*.txt'; # change to the directory where we want to receive the file chdir( $local_dir ); my $ftp = Net::FTP->new( $rem_server ) or die "Cannot connect to $rem_server: $@\n"; $ftp->login( $rem_id, $rem_pw ) or die "Cannot log in to $rem_server: $!\n"; $ftp->binary or die "Cannot set binary mode: $!\n"; $ftp->cwd( $rem_dir ) or die "Cannot change to directory $rem_dir: $!\n"; my @files = $ftp->ls( $file_mask ); $ftp->get( $_ ) for @files; $ftp->quit; __END__ John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]