Last active
July 13, 2018 19:20
-
-
Save trafficinc/2a143d2d9f6055207d2b16a17e3ea25a to your computer and use it in GitHub Desktop.
Python script that will find a file in directories below parent Dir recursively
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
#!/usr/bin/python3 | |
# use: $ python findFile.py "view.html" | |
import os,sys | |
fileLook = sys.argv[1]; | |
rootdir=('/var/www/mysite/public') | |
for root, directories, filenames in os.walk(rootdir): | |
try: | |
for filename in filenames: | |
if filename == fileLook : | |
print os.path.join(root,filename) | |
except IOError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment