Created
December 16, 2017 18:12
-
-
Save Kyu/b74a20858251710d966e9c8bfb2b9c83 to your computer and use it in GitHub Desktop.
searches files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def search(path, query): | |
results = [] | |
q = query.lower() | |
for root, dirs, files in os.walk(path): | |
for file in files: | |
if q in file.lower(): | |
results.append(os.path.join(root, name)) | |
for ls in dirs: | |
if q in ls.lower(): | |
results.append(os.path.join(root, ls)) | |
return results | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment