| SaturN |
Jul 23rd, 2005 1:27 PM |
An alternative to 'Windows Search'...
got sick of windows search funtion, seemed slow to me!! might just be crap computer, so i decided to cook up my own version in Python, so if anyone is interested in a replacement!
Here it is
:
#Python version 4.1
import re, os, sys
print '''
This Program Is A File Search Program
enter a path
then enter a search term
program will return any files found!
'''
def Main():
path = raw_input("Path: ")
s = raw_input("Search: ")
s = s.lower()
s = s.split()
for root, dirs, files in os.walk(path):
for name in files:
for a in range(len(s)):
if re.search('.*?%s'% (s[a]), name.lower()):
print '\nFile Found'
print os.path.join(root, name)
for name in dirs:
for a in range(len(s)):
if re.search('.*?%s'% (s[a]), name.lower()):
print '\nDirectory'
print os.path.join(root, name)
s_a = raw_input("New Search? (Y/N) ")
if s_a.lower() == 'n':
sys.exit()
else:
Main()
Main()
If anyone likes the idea, I might move on to a GUI version, and another which will included a startfile function, :P
Lemme know of any glitches Thanks
|