|
6 | 6 | ## Copyright (c) Jonathan Serrano, 2023
|
7 | 7 | ## ---------------------------
|
8 | 8 |
|
| 9 | +#!/usr/local/bin python3 |
| 10 | +## --------------------------- |
| 11 | +## Script name: PrintHierarchy.py |
| 12 | +## Purpose: Input file paths and print out file heirarchy tree |
| 13 | +## Author: Jonathan Serrano |
| 14 | +## Copyright (c) Jonathan Serrano, 2023 |
| 15 | +## --------------------------- |
| 16 | + |
9 | 17 | import sys
|
10 | 18 | import os
|
11 | 19 |
|
@@ -43,17 +51,8 @@ def main(input_paths):
|
43 | 51 | print(f"Tree output saved to: {output_file_path}")
|
44 | 52 |
|
45 | 53 | def test():
|
46 |
| - home_dir = os.path.expanduser("~") |
47 |
| - home_tree = {"~": {}} |
48 |
| - for root, dirs, files in os.walk(home_dir): |
49 |
| - curr_dir = root.replace(home_dir, "~") |
50 |
| - parent_dir = os.path.dirname(curr_dir) |
51 |
| - add_to_tree(home_tree.setdefault(parent_dir, {}), [os.path.basename(curr_dir)]) |
52 |
| - for file in files: |
53 |
| - add_to_tree(home_tree.setdefault(curr_dir, {}), [file]) |
54 |
| - |
55 |
| - print("Home Folder Hierarchy:") |
56 |
| - print_tree(home_tree) |
| 54 | + input_paths = ["dir1/dir2/file1.txt", "dir1/dir3/file2.txt", "dir4/file3.txt"] |
| 55 | + main(input_paths) |
57 | 56 |
|
58 | 57 | if __name__ == "__main__":
|
59 | 58 | input_paths = sys.argv[1:]
|
|
0 commit comments