Created
February 15, 2021 21:13
-
-
Save isaidnocookies/e120a989a0acbeae4bb50e55a9f21004 to your computer and use it in GitHub Desktop.
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/local/bin/python3 | |
import os, sys | |
from pathlib import Path | |
def parseDirectories(rootdir): | |
for subdir, dirs, files in os.walk(rootdir): | |
for file in files: | |
if ('.DS_Store' in file): | |
continue | |
filePath = os.path.join(subdir, file) | |
parentName = os.path.split(Path(filePath).parent)[-1] | |
print ('{} -> {}'.format(parentName, file)) | |
with open(filePath, encoding="latin-1") as fileObj: | |
data = fileObj.read() | |
print ('{}\n'.format(data)) | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
exit() | |
else: | |
parseDirectories(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment