Home > other >  How to recursively find the largest non-compressed files in a directory
How to recursively find the largest non-compressed files in a directory

Time:08-18

I want to make a text file that lists the largest files w/ size > 100M without ".gz" extension,

I am trying this:

find . -type f -size  100M ! -name "*.gz" | find -printf '%s %p\n'|sort -nr|head

Which still seems to list files with gzip. I am starting to think the issue is after the pipe, because without the pipe the first half seems to work correctly but does not pretty print file sizes and sort, which is helpful to me . Any advice is appreciated.

CodePudding user response:

You don't need two find

just:

find . -type f -size  100M ! -name "*.gz" -printf '%s %p\n'|sort -nr|head
  •  Tags:  
  • bash
  • Related