DIY File Index
Windows has had a search option for a very long time. The problem that I have with it is two-fold:
- It is slow
- The indexer is a real
- resource hog
So, a long time ago, I learned how to index all of the files on my computer that provides me with accurate results in a fraction of the time. And, the index is completely portable so I can keep a copy of the index on my USB drive so that I can tell my wife exactly where that file is on my computer at home that I need at work.
How exactly is this done? Read on.
Create the Index
The index is really nothing more than a text file listing every single file that is on your computer’s hard drive. To create the index, simple go to a command prompt and type the following:
dir c:\ /s /b>>fileindex.txt
Wait for a couple of seconds and it will be done. If you want to add more hard drives to the index, simply retype the command and change the c: drive letter in the command to the other drive letter you want to index.
Search the Index
The next step is to search the file index for a file you are looking for. Let’s say you are looking for a file with the word “accounting” in it. You would use the following command to get a list of all the files with the work “accounting” in them:
find "accounting" fileindex.txt
You will instantly get the results. No waiting!
Updating the Index
Since it is so quick and easy to build the index, to update the index all you need to do is delete the fileindex.txt file and recreate the index just like you did earlier.
Suggestions
What you may want to do to simplify the process is create a couple of batch files to simplify the process. For example, you could create a batch file called MakeIndex.bat that would delete the fileindex.txt file and then rebuild it with information from all of your hard drives. This file may look something like this:
@echo off
del fileindex.txt
dir c:\ /s /b>>fileindex.txt
dir d:\ /s /b>>fileindex.txt
You could also create a file called WhereIs.bat that will find your files easier for you. It might look something like this:
@echo off
find %1 fileindex.txt
Now, all you would have to type is:
WhereIs "accounting"
This will give you the same results!
If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?
| Trackback link - http://www.dailycupoftech.com/2008/08/28/diy-file-index/trackback/ |
|
10 Responses to “DIY File Index”
-
Joe Says:
August 28th, 2008 at 5:54 amToo bad this doesn’t give you the ability to search within files of many types as well, as Windows’ and Google’s indexers do. However, since I myself almost never search within files, I’m going to give it a try.
-
Nevel Says:
August 28th, 2008 at 5:59 amThe search function of Total Commander is one of the main reasons never to use the standard Win explorer again.
Works like a charm, highly configurable and really fast.
And it avoids the need of this kind of tweaks.
Even though tweaking can be fun
-
Thomas Black Says:
August 28th, 2008 at 7:18 amGreat post. Sometimes we forget that the simple ways are the best.
If someone was really aching for a google like search they could easily output the find string into an html page and then execute that page load in their favorite browser. -
Angus S-F Says:
August 28th, 2008 at 10:05 pmLocate32 is freeware that maintains an updated list of all files on your system automagically — way faster than manually doing things the way you’re doing it. http://www.locate32.net/
Unfortunately those of us who grew up in the days of 8.3 filenames and have gigabytes of legacy files need more than this.
-
Dave F Says:
August 29th, 2008 at 12:03 pmWow, for a two second index completion, you must have a really small hard drive with not many files because my system just took over 5 minutes to generate a 12.4 MB file index. Or am I missing something here? I have an 80 gig hard drive with about 35 G used. Maybe that’s why my system seems to hog so much time running find.exe?
-
Tim Fehlman Says:
August 29th, 2008 at 12:38 pm@Dave F,
I have a 110GB hard drive with 60GB of data. I did an actual time test and my computer generated a 10.8 MB index file in exactly 5.12 seconds. The index file had 117230 file entries in it.It could be that I just have a faster computer and hard drive.
Tim
-
Dave F Says:
August 29th, 2008 at 12:58 pm@Tim F,
Maybe my computer has a serious issue. It’s a Dell Optiplex 745 with a Core 2 CPU at 1.8 GHz and a Gig of RAM, so it seems fast. Could it be the virus protection checking everything and slowing me down? -
Tim Fehlman Says:
August 29th, 2008 at 1:16 pm@Dave F,
That is definitely a possibility. You could also have a slow hard drive. This is often a bottleneck.
Tim
-
jambarama Says:
August 29th, 2008 at 3:01 pmI actually really like this solution. It was plenty fast on my old POS desktop (1.6ghz celeron, 2gb ddr2 memory, 7200 rpm sata drive) - maybe 10 seconds. Works somewhat like locate on in bash. I sure wish there was a windows equivalent to find though…
Thanks for the post!
-
Alex Says:
August 30th, 2008 at 9:02 pmFYI You don’t need to delete the file if you are going to be making a new one. If you use 1 “>” mark it will create the file “>>” appends data.
@echo off
dir c:\ /s /b>fileindex.txt
dir d:\ /s /b>>fileindex.txt
Should work.
