I am looking for a handy one-liner for computing the average file size in a directory.
What I want is:
size of all files / number of files in directory
|
I am looking for a handy one-liner for computing the average file size in a directory. What I want is: size of all files / number of files in directory |
|||||
|
|
With GNU find:
Or for disk usage:
Note that if there are several hardlinks of the same file in there, that will count its disk usage several time. The above only counts regular files, not symlinks or directories or other special files. It includes hidden files. The same with
|
||||
|
|
|
A simplistic solution in one line:
It has a syntactic cheat in it, only considering |
||||
|
|
|
for only files in a directory, ignoring sub directories:
Or to count all files including files in subdirectories:
|
|||||||||||
|
|
With FreeBSD / Mac OS X
|
|||
|