> > > > Johnson, Shaunn wrote:
> > > > > Howdy:
> > > > >
> > > > > I'm looking for information that will let me
> > > > > open an ftp connection and grep / search
> > > > > for files and then FTP them back to me.
> > > >
> > > > What do you mean "grep/search" for files? If you want to search 
> > > > for particular file *names*, Net::FTP can return a list 
> of files 
> > > > and directories you can examine.
> > >
> > > True, but it is an inadequately documented feature of the 
> module.  
> > > The pod indicates only an optional DIR parameter for the ls 
> > > function:
> > >
> > >     ls ( [ DIR ] )
> > >         Get a directory listing of "DIR", or the current 
> directory.
> > >
> > >         In an array context, returns a list of lines 
> returned from the
> > >         server. In a scalar context, returns a reference 
> to a list.
> > >
> > > But the following:
> > >
> > > my @files = $ftp->ls("*.jpg");
> >
> > Since there is noe directory '*.jpg' it just does the ls on the cwd.
> 
> Yeppers.
> 
> > So DIR is a directory, /images for instance
> 
> Nope.  The directory being queried contains 50-100 files, of 
> all types.

No no, /images was an example of what you might want to put there instead of trying 
regexes.

For /home/ftpuser/public_html/images would be
 $ftp->ls("/public_html/images");

> 
> >
> > It looks like you are trying to ls jpg files but this isn't 
> grep and 
> > the regex isn't even right, it looks more like a winders type thing.
> 
> The directory is on a Linux web-server.
> The OP was concerned with fileglobbing through the Net::FTP 
> ls function, not grep.

But the subject says grep? :)
So basically: you can ls a directory for list of files and you 
can then grep that array of filenames in your script but to actually 
grep()the contents of the files listed you'd have to:

Ftp them to yout local file system or at least inside your script or 
you could use Telnet or ssh and run cat/grep commands on the file 
contents. But with FTP there is no way to look at the contents of 
the file without transfering the file to your script first.

Maybe I could add a grep function to my Net::FTP helper functions in a module I may 
Do if I ever get time! 

> 
> Dan, it works.
> 
> Joseph

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to