total size of group of files selected with 'find'

后端 未结 7 1913
庸人自扰
庸人自扰 2020-12-07 16:32

For instance, I have a large filesystem that is filling up faster than I expected. So I look for what\'s being added:

find /rapidly_shrinking_drive/ -type f          


        
7条回答
  •  轮回少年
    2020-12-07 17:15

    Darn, Stephan202 is right. I didn't think about du -s (summarize), so instead I used awk:

    find rapidly_shrinking_drive/ -name "offender1" -mtime -1 | du | awk '{total+=$1} END{print total}'
    

    I like the other answer better though, and it's almost certainly more efficient.

提交回复
热议问题