Created
November 30, 2023 20:46
-
-
Save holmanb/5537596264de068a0745ddb8850c5883 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/env python3 | |
import sys | |
import os | |
from pathlib import Path | |
help = """\ | |
iterate a directory of directories, printing | |
the files in the sub-directory as alphabetical csv | |
python3 iter_dir.py /some/path | |
""" | |
if len(sys.argv) == 1 or "help" == sys.argv[1]: | |
print(help) | |
os._exit(0) | |
for file in Path(sys.argv[1]).iterdir(): | |
if file.is_dir(): | |
print(",".join([str(f) for f in Path(file).iterdir()])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment