On Friday 24 August 2007 08:57:26 Marian Bednar wrote: > Hi all, > > > I am a newbie in this forum and Perl too ;-) > > I am trying writing script transfering files using module > Net::SFTP::Foreign. > > I need to retrieve from remote directory only names of files (not > directories, links,etc.). > > Something like this doesn't work: > > -------------- > use strict; > use warnings; > use Net::SFTP::Foreign; > > my $remote_dir = "/tmp"; > my $sftp = Net::SFTP::Foreign->new("host"); > $sftp->error and print "SSH connection failed: " . $sftp->error . "\n"; > > $sftp->setcwd($remote_dir); > my $DH = $sftp->opendir($remote_dir); > while ($_ = $sftp->readdir($DH)) { > print "$_->{filename} \n" if -f $_->{filename}; > } > --------------- > > Script above write out nothing, but if last line is this > > print "$_->{filename} \n"; > > It writes out names of files, directories, but I need only names of files. > How can I get it easy? > > Thanks. > > Marian
You cannot use -f. You'll need to stat the file and check the mode. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/