Find 100 largest files in folder tree
Hi,
I have a folder with many subfolders and files that I'd like to list the largest 100 files in. I'm pretty sure I need to use a combination of find and ls, but I'm not sure exactly what will let me do this. Thanks |
Check out this link for some ideas http://www.debian-administration.org/articles/143
Or try something like find / -size 10000k to find the files over XXXX bytes... |
Empirically, the way to find the 100 largest files would be like this:
find . -ls | sort -rn +6 -7 | head -100 This does a long listing on all the files under "." (you could use any directory), sorts them by size (reverse order) and gives the first 100. The main problem with this approach is that if the number of files is very large (I'd say over 100,000) it could take a while. These are pretty fast commands, though, and would run fairly quickly on most systems. Also, the output is in a long listing-like format, so you probably would need to crunch it through AWK to get just the info you're looking for. Hope that helps. WilliamsJD |
All times are GMT -5. The time now is 08:21 AM. |