linebacker has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w use Net::FTP; #use strict; $host = 'www.ftp.com'; $user = 'anonymous'; $pass = 'updatepuller@somewhere.com'; $remote_dir = '/path/to/remote/directory'; $oldfilename = `ls current-sig`; chomp $oldfilename; $destination_dir= "current-sig"; $ftp = Net::FTP->new($host, Debug => 1); $ftp->login($user,$pass); my @listing = $ftp->ls("$remote_dir"); for (@listing) { if ( /x86.exe/i ) { open(FH, ">> myfile.txt") || die "Can't open $file for write: $!"; print FH "$_\n" } } close FH; open FH, "myfile.txt" or die "Couldn't open: $!"; while (<FH>) { @test = print "$_" } close FH; #$ftp->get("$remote_dir/$filename","$destination_dir/$filename"); $ftp->pasv(); $ftp->quit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pattern matching question
by Anonymous Monk on Jun 24, 2002 at 20:58 UTC | |
|
Re: Pattern matching question
by Hofmator (Curate) on Jun 25, 2002 at 10:35 UTC | |
by linebacker (Scribe) on Jun 25, 2002 at 18:43 UTC | |
by Hofmator (Curate) on Jun 25, 2002 at 19:16 UTC |