What is the best and fastest way to calculate directory sizes? For example, we will have the following structure:
/users
/a
/b
/c
/...
We need output for each user directory:
a = 1224KB
b = 3533KB
c = 3324KB
...
We plan to have tens, maybe one hundred thousand directories under / users. The following shell command works:
du -cms /users/a | grep total | awk '{print $1}'
But we have to call him N times. The thing is that conclusion; Each user directory size will be stored in our database. In addition, we would like it to be updated as often as possible, but without blocking all resources on the server. Is it even possible to count the size of the user directory every time? How about every 5 minutes?
, , node.js? , . PHP Python, , .
.