Use FTP to Search for Text in Filename or Content

Search for String Using FTP

If you need to search an entire directory via FTP for a text string (or search by filesize, date, or path), I’ve got some good news and some bad news. The good news it, if you are searching for files containing the string in their name: you can do it easily with FileZilla. The bad news is, there isn’t really a way to search the CONTENT of all the files via FTP. You could, however, download every file using FTP and then search the content locally with a program like Notepad++.

Otherwise, if you want to search the content of files without downloading them first, you would need to use SSH or something similar. Here’s how that would work:

A simple SSH command to do a search for “searchstring” in the current folder and all subfolders would look like this:

grep -rli "searchstring" *

But most importantly, I want to show you how to use FileZilla to search for files with a given string in their file names. It’s actually quite simple!

1. Connect to your FTP server using FileZilla.
2. Click Server -> Search remote files… (or just press F3)
3. Fill in the fields you want. Note that you HAVE to enter something in for “Search directory:”. To just use the directory you are in, enter “/”.
4. Press search!

That’s it! Try and take advantage of the different search criteria you can use. There are plenty of comparison operators in there to mess with. “Contains” is most likely the one you want, as “equals” will require an exact match to work.

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.

10 Comments on “Use FTP to Search for Text in Filename or Content”

  1. You can’t use FTP to search for a term in content. I agree with Samantha, you should change your title.

    1. No, but in all fairness he does make a person aware it is not possible and gives a solution by downloading and searching if you don’t have SSH access.

  2. You can’t use FTP to search for a term in content. I agree with Samantha, you should change your title.

  3. How does TotalCommander do its file content (regex) search then? Does it download files to search for a string in the file content?

    1. I couldn’t tell you as I’ve never used the program. I suspect it just communicates with the server and performs an action similar to what you’d do with SSH.

    1. How so? I show how to search the content of files with SSH right above!

      If you wanted to search for filenames, you would just do:

      find . -name myFile.txt

      Or you could use wildcards:

      find . -name "myFile*"

      1. No, I think the title is misleading as well. I came here because the post title is ‘Use FTP to Search for Text in Filename or Content’

        At no point have you showed me how to use FTP for a search in file content.

        The post ranks highly, I guess that’s why it hasn’t been removed.

        1. I mean, I rank highly for that term because I have the answer to the question, “How can I use FTP to search for text in filenames or content?”

          The answers are:

          For filenames: here’s how!

          For content: you can’t without downloading the files first. But here’s an alternative you can probably do.

          I answer the question; it’s not my fault the answer isn’t what you want to hear. But regardless: I saved you the time of having to wade through the other likely-more-irrelevant results Google provides for you in order to get the correct answer. There’s still value in that. I could change the title to, “You cannot use FTP to search for content in files” but that would never rank and therefor I would not be able to give you the answer which you seek, which is that it’s impossible.

Leave a Reply

Your email address will not be published. Required fields are marked *