简体   繁体   中英

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

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.

You don't need two find

just:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM