How to calculate the total size of certain files only, recursive, in linux

后端 未结 3 1877
攒了一身酷
攒了一身酷 2020-12-29 12:27

I\'ve got a bunch of files scattered across folders in a layout, e.g.:

dir1/somefile.gif
dir1/another.mp4
dir2/video/filename.mp4
dir2/some.file
dir2/blahbla         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-29 12:49

    This will sum all mp4 files size in bytes:

    find ./ -name "*.mp4" -printf "%s\n" | paste -sd+ | bc
    

提交回复
热议问题