EvilZone
Programming and Scripting => Scripting Languages => : Clone February 02, 2014, 09:11:19 PM
-
This is a python script to search for files and directories in root.Its kinda slow i was hoping for corrections
import os
count=0
print"File Searcher"
print"---------------------------------------------------------------"
print"---------------------------------------------------------------"
filename=raw_input("Enter file name to be searched:")
print"Searching for %s..."% filename
for rootDir,dirs,files in os.walk("/"):
for Dir in dirs:
if Dir.endswith(filename):
print count,".)PATH:",rootDir+"//"+Dir
count=count+1
for fileX in files:
if fileX.endswith(filename):
print count,".)PATH:",rootDir+"//"+fileX
count=count+1
count=count-1
print"End of search."
if count<=0:
print"No results matching \"%s\" found"% filename
else:
print"No of results found matching \"%s\"is %d"% (filename,count)
-
I don't really see the purpose for this tool, sorry. Pretty much all OS's has a feature like this built in.
-
No problem if it is a learning project or can be use in another script for instance where you hate to call the system's Find.