Created
October 26, 2020 19:04
-
-
Save Donpedro13/af8487b1a669b41c0dd8af0824e31a77 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
import os | |
import sys | |
def usage(): | |
print("Usage: readfolder.py [folder]") | |
def doread(dir): | |
for root, dirs, files in os.walk(dir): | |
for file in files: | |
fpath = os.path.join(root, file) | |
with open(fpath, "rb") as f: | |
f.read(os.path.getsize(fpath)) | |
print("Read {}".format(fpath)) | |
def main(): | |
if len(sys.argv) != 2: | |
usage() | |
sys.exit(-1) | |
print("About to read all files in {}...".format(sys.argv[1])) | |
doread(sys.argv[1]) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment