diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-08-23 15:53:39 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-08-23 15:53:39 -0700 |
commit | f246a05b4d192a3f2ba717541d182ab3bcb830de (patch) | |
tree | b0cd7c9793125dfbfe42726aaf02d1e6b597b7ca /analyze_binary.py | |
parent | 6ad783f441ffc2f822c494608bc6587a0152c04a (diff) | |
download | sncontinue-f246a05b4d192a3f2ba717541d182ab3bcb830de.tar.gz sncontinue-f246a05b4d192a3f2ba717541d182ab3bcb830de.tar.bz2 sncontinue-f246a05b4d192a3f2ba717541d182ab3bcb830de.zip |
build: :construction_worker: update build script for m1
Diffstat (limited to 'analyze_binary.py')
-rw-r--r-- | analyze_binary.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/analyze_binary.py b/analyze_binary.py new file mode 100644 index 00000000..4fc1c711 --- /dev/null +++ b/analyze_binary.py @@ -0,0 +1,27 @@ +from collections import defaultdict + +# Initialize a dictionary to store the sizes of the folders +folder_sizes = defaultdict(int) + +# Parse the file +with open( + "archive_contents.txt", "r" +) as f: # replace 'file.txt' with your file name + for line in f: + parts = line.split(",") + if len(parts) < 2: + continue + size = int(parts[1].strip()) # get the size + path = parts[-1].strip() # get the path + + # Split the path into its components and accumulate the sizes for each folder + path_parts = path.split("/") + top_level = path_parts[0] + folder_sizes[top_level] += size + +# Sort the folders by size in descending order +sorted_folders = sorted(folder_sizes.items(), key=lambda x: x[1], reverse=True) + +# Print the sorted folders and their sizes +for folder, size in sorted_folders: + print(f"{folder}: {size}") |