"Locate" command in Python
Adonis
adonisv at DELETETHISTEXTearthlink.net
Mon Apr 10 09:14:45 EDT 2006
BartlebyScrivener wrote:
> How about one of these that works on Windows XP? I know there's no
> files.cache, but I wonder if your script could be combined with another
> function that would generate a list of paths on a Windows XP machine.
>
> Anyway, thanks for the script.
>
I wrote it on a Windows XP machine. The files.cache is generated when
you use the -u option. For example if you saved the script as locate.py
first at a command prompt: python locate.py -u this will create the
files.cache, it simply walks through your entire hard drive writing all
the directories and files it finds along the way. Then doing: python
locate.py SomeFileOrDirName will go through the files.cache matching
whatever term your looking for if present. Although the rootPath
variable is set to the POSIX style path of "/" Python converts it to a
proper path. At least thats my assumption as it works fine on my system.
Adonis
More information about the Python-list
mailing list