How to Find Forgotten Files or Folders Using the Command Prompt

raccoon-mascot

It happens from time to time that people forget things. For example they put a file on a hard drive somewhere. A few years go by and they need to find that file. Except that now there are a million files on the drive and no clear idea where the file might be.

Today, I will be looking into variations of this problem and the various solutions that exist for Windows users.

The Setup

In all cases, I will be using the Command Prompt. It is accessible via Start > All Programs > Accessories.

There are various commands and command options available to Windows users that can help find any file or folder in a fraction of a second.

I will be using the G: drive as the source drive, i.e. where the forgotten file or folder is located.

Because of that I will type G: into the Command Prompt, so that I don’t have to specify the source drive in every command.

cmd-prompt-initial-setup

Command Prompt Initial Setup

You can copy-paste all commands from this tutorial, but when pasting it into the Command Prompt window instead of Ctrl+V use right-click and then select Paste from the drop-down menu.

The Basics

To find a specific PDF file somewhere on your drive, simply use the following command:

The /s parameter orders the command to look for the file in all sub-folders recursively.

To find a DOC file that we remember contains the word Partial in its file name, use this command:

But what if we don’t remember the file name at all, only that it’s a ZIP file? Use this then:

if it is a folder we are looking for, we use:

The /ad parameter tells the command only to search for folders and ignore all files.

If we are not sure how we named the folder, we can use:

cmd-prompt-full-output

Command Prompt Full Output

Tweaking the Search

If there are a lot of results, we can use the /b parameter, to make the output cleaner and more easily readable.

Examples:

cmd-prompt-bare-output

Command Prompt Bare Output

If we want to save the results for later use, we can divert the output to a text file, like this:

Advanced Search

What if we know that the file we are looking for was created on September 25, 2014 but don’t remember its name or type?

Use:

Now what if we know that we created the file somewhere between January and March 2012 but, again, don’t remember its name or type?

Use the following command:

In this case we are required to specify the source drive even though we are on it.

As a side note, should a search take too long, we can always abort it by pressing Ctrl+C.

Final Thoughts

That’s what I call command prompt porn. 🙂

I hope that this short tutorial helped you find that long lost file or folder. If not, let me know in the comments below and I might be able to come up with a command for your specific needs.

Liked this post?

Subscribe to our newsletter to receive early notification of new posts and deals:

Next Post »« Previous Post

Leave a Reply

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