Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Jul 23rd, 2005, 1:27 PM   #1
SaturN
Programmer
 
Join Date: Apr 2005
Location: Uk
Posts: 68
Rep Power: 4 SaturN is on a distinguished road
Cool 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,
Lemme know of any glitches Thanks
__________________
while me is alive:
	make(life,simple)

Last edited by SaturN; Jul 23rd, 2005 at 1:46 PM. Reason: sys not imported :DOH:
SaturN is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC