diff --git a/wizard-work/spark/count_py_files.py b/wizard-work/spark/count_py_files.py new file mode 100644 index 0000000..023f6f5 --- /dev/null +++ b/wizard-work/spark/count_py_files.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +"""Count Python files in directory tree recursively.""" +import sys +from pathlib import Path + +def count_py_files(directory: str = ".") -> int: + """Count Python files in directory tree.""" + return len(list(Path(directory).rglob("*.py"))) + +if __name__ == "__main__": + target = sys.argv[1] if len(sys.argv) > 1 else "." + print(count_py_files(target)) \ No newline at end of file