Sample Header Ad - 728x90

How can I generate a spreadsheet of a folder structure on my computer with folder sizes included?

0 votes
0 answers
581 views
I'd like to make a spreadsheet of a folder structure in my filesystem. Given a parent folder or volume as the input, the output should include: 1. Subfolders to the nth level (user-specified) 2. A clean/readable visual format showing the folder names and their hierarchy (perhaps each next level in the path breaks out to a new column) 3. The total size of each folder in GB You can't copy and paste more than the names of files directly from Finder, so I understand Terminal / zsh would be the way to achieve this. What command line code would output this result? **What I've tried:** Changing directory to the desired folder in Terminal and running du -k -d 3 gets me somewhat close (-k meaning kilobytes and -d 3 meaning depth of 3). But it's quite an unruly list that is tedious to translate into a spreadsheet format. I'd still prefer to export a .csv from that, generate GB to the second decimal place instead of KB, and perhaps have each level in the path name break out into a new column of the .csv.
Asked by gills (321 rep)
Jun 29, 2022, 01:35 AM
Last activity: Jul 1, 2022, 12:02 AM