File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ def get_dir_sizes(path="."):
1212 full_path = r"\\?\\" + os .path .abspath (full_path )
1313
1414 size = os .path .getsize (full_path )
15- dir_name = os .path .relpath (root , path )
16- dir_sizes [dir_name ] = dir_sizes .get (dir_name , 0 ) + size
15+ dir_path = os .path .relpath (root , path )
16+ dir_sizes [dir_path ] = dir_sizes .get (dir_path , 0 ) + size
1717 except (FileNotFoundError , PermissionError , OSError ):
1818 continue
1919 return dir_sizes
@@ -40,9 +40,9 @@ def main():
4040 print (f"{ 'Directory' :40s} | { 'Size (MB)' :>10s} " )
4141 print ("-" * 60 )
4242
43- for dir_name , size in sorted_dirs [: args .top ]:
43+ for dir_path , size in sorted_dirs [: args .top ]:
4444 size_mb = size / (1024 * 1024 )
45- print (f"{ dir_name :40s} | { size_mb :10.2f} " )
45+ print (f"{ dir_path :40s} | { size_mb :10.2f} " )
4646
4747 print ("-" * 60 )
4848 print ("✅ Disk usage analysis complete." )
You can’t perform that action at this time.
0 commit comments