IS there an FTP tool that can search for a phrase in all the files in a directory?

Solution 1:

If you have more than just FTP access then it is possible with WinSCP and grep:

http://winscp.net/eng/docs/remote_command

http://winscp.net/eng/docs/custom_commands#search_text

Solution 2:

Not via FTP, no. FTP does not have a search or grep function for files, it's simply for transferring.

Solution 3:

You can script this in PowerShell using WinSCP .NET assembly:

  • recursively list all files in a directory using the Session.ListDirectory;
  • download files one by one to a local temporary folder using the Session.GetFiles;
  • search the contents of local copies (using the cmdlet Select-String) and remove the copy afterwards.

For complete code, see Search recursively for text in remote directory / Grep files over SFTP/FTP protocol.


If you have a shell access, you can search remotely (as the answer by @Shevek already pointed out).
See Searching for a text/string within a directory.

But that's not FTP-based solution anymore.