I’m looking for a tool that will tell me which folders on my Mac have the most files in them – the largest NUMBER of files, not the largest files by size. Anybody know of anything that will do that?
Ideally, I’d like to get a list – here are the folders with the largest number of files in them, in order by number of files, and how many files are in each.
This is to solve a problem I’m having with BackBlaze.
Anybody know of a utility or a command line that can answer this question for me?
Thanks! I tried that in my Documents folder and the result returned a single number. Is there a way to get a list of folders and sub-folders, with the number of files in each folder, ranked from largest number of files to smallest?
Open terminal, go to the folder you want to look at (cd Documents or whatever) and run: find . -maxdepth 1 -type d -print0 | while read -d ‘’ -r dir; do num=$(find $dir -ls | wc -l); printf “%5d files in directory %s\n” “$num” “$dir”; done
import os
path = '/Users/you_user/Documents/' #insert your path
cutoff = 0 # cutoff parameter, will ignore folders with number of files less than n
for dir,subdir,files in os.walk(path):
if len(files) > cutoff:
print(dir, str(len(files)))
Sorry, I don’t know why this didn’t occur to me earlier. HoudahSpot can do this. You can choose to have HoudahSpot display any attribute you wish in columns. Just click the column headers, choose “More Columns…” and pick the attribute you want displayed.
HoudahSpot uses Spotlight data, and it should merely be reading that metadata cache so it’s not polling the entire machine. (Unlike OmniDisksweeper, which looks inside every folder every time it is launched.)