Unix find average file size

前端 未结 7 2327
忘掉有多难
忘掉有多难 2020-12-13 09:23

I have a directory with a ton of files I want to find the average file size of these files so something like ls somethinghere whats the average file size of everyth

相关标签:
7条回答
  • 2020-12-13 10:17

    du -sh . # gives the total space used by the directory

    find . -type f | wc -l # count the number of files

    devide the first by the second. If you want a one liner, here it is:

    echo $(( `du -sb | tr '.' ' '` / `find . -type f | wc -l` ))
    
    0 讨论(0)
提交回复
热议问题