commit e4c7c2a75bd4ef9095be0c7abcaa32de4ed0b90c Author: Mylloon Date: Thu Jun 3 21:19:51 2021 +0200 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3f092da --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/resultat.txt +/zipped \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..2d04fc1 --- /dev/null +++ b/main.py @@ -0,0 +1,19 @@ +from os import walk +import sys +from pathlib import Path + +def listeDossier(path = None): + if path == None: + path = Path().absolute() + else: + path = Path(path) + + _, _, filenames = next(walk(path)) + + with open(path.parent.absolute() / "resultat.txt", 'w') as f: + f.write('\n'.join(filenames)) + + return "Done!" + +if __name__ == "__main__": + print(listeDossier(sys.argv[1] if len(sys.argv) > 1 else None))