Skip to content

Instantly share code, notes, and snippets.

@halit
Created August 16, 2012 10:55
Show Gist options
  • Save halit/3369259 to your computer and use it in GitHub Desktop.
Save halit/3369259 to your computer and use it in GitHub Desktop.
My Recursive File Searcher in Python
def dosyalama(yer, uzanti):
dosyalist = []
for kok, altdizinler, dosyalar in os.walk(yer):
for dosya in dosyalar:
if dosya.endswith(uzanti):
dosyalist.append(os.path.join(kok,dosya))
return dosyalist
def aramayap(yer, kelime, uzanti):
yer = str(yer)
kelime = str(kelime)
uzanti = str(uzanti)
dosyalar = dosyalama(yer, uzanti)
for dosya in dosyalar:
satirlar = open(dosya)
for satir in satirlar:
if satir.find(kelime) > 0:
if self.bulunan.count(dosya) == 0:
self.bulunan.append(dosya)
return 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment