Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Net::FTP Help !
>
> Hi Guys and Gals ,
>
>  I'm new to perl ... Here is my problem ..
>
> I'm connecting fine to the remote computer and logging in fine .. what I
> want to do is  a get all files from the remote directory . Here is is a
> snippet of the code
>
> $ftp->cwd($remote_dir)
> or die "cannot change working directory ", $ftp->message;
>
> # show current directory
> $ftp->pwd();
>
>
> @all_files = $ftp->ls();
>
> print @all_files;
>
>
> foreach $file(@all_files) {
>
> $ftp->get($file)
> or die "cannot get file", $ftp->message;
> }
>
>
>
> The problem is that the remote directory has a subdirectory in it so the
> array reads it in @all_files = $ftp->ls; so when I go to do a
> $ftp->get($file) it reads the subdirectory name into it as well so it
> bombs out saying it cannot find file BLAH BLAH ... is there a way to
> read the directory without the subdirectory in there .. just the files I
> want to get .
>
>
>
> Hope this is clear ..
>
>

You can use the 'dir' method to get a long listing, which should include
the permissions string. Then you can step through the list and pull only
those files that don't start with a 'd'.  This requires more parsing and
is less precise but is the only way I know to do it. I thought someone
was writing an extension that did this automatically but don't know if
it has made its way to CPAN.

http://danconia.org

Report this thread to moderator Post Follow-up to this message
Old Post
Wiggins D Anconia
08-10-04 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PERL Beginners archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.