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.
In all cases, I will be using the Command Prompt. It is accessible via
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.
You can copy-paste all commands from this tutorial, but when pasting it into the Command Prompt window instead of Ctrl+V use
To find a specific PDF file somewhere on your drive, simply use the following command:
dir CompleteFileName.pdf /s
/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
dir *Partial*.doc /s
But what if we don’t remember the file name at all, only that it’s a ZIP file? Use this then:
dir *.zip /s
if it is a folder we are looking for, we use:
dir CompleteFolderName /ad /s
/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:
dir *PartialFolderName* /ad /s
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.
dir *.zip /s /b
dir *PartialFolderName* /ad /s /b
If we want to save the results for later use, we can divert the output to a text file, like this:
dir CompleteFolderName /ad /s /b >> D:\foundit.txt
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?
forfiles /s /d 25.09.2014 /c "cmd /c echo @fdate @path"
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:
robocopy G: D: *.* /FP /L /S /NDL /TS /MAXAGE:20120101 /MINAGE:20120331 >> D:\foundit.txt
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
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: