Search Within Files On Remote FTP Site

Baxter picture Baxter · Apr 8, 2012 · Viewed 10.2k times · Source

I am looking for a way to search within all files / directories on a remote ftp server for a certain line of text.

So far I am using Cygwin to make the ftp connection using lftp. The furthest I've got is using the command:

ls -l | grep pattern

...while in lftp mode.

However, that simply looks over the file names returned for the pattern. I want to search within the files for the pattern.

Perhaps there is a software package that allows for this already.

Any ideas on how to do this?

Answer

Curtis picture Curtis · Jun 7, 2012

You'd have to either have:

  • an FTP client that would download all the content, and then searched it (probably defeating the point), or
  • the server would have to have some extension that supported searching (which I've never heard of)

There are some alternatives over on askubuntu.com that might help, but unless you can get shell / SSH access on the remote server, everything's going to be a variant of download it all and search it locally.