Skip to main content

Calculating Size of the Specific Folders - Linux Command

To calculate total size of the directories that have specific name under a directory

Following command lists subfolders
find <folder name> -type d

Append this to get size of folders
-exec du -s {} \;

Append this to list only matching folder names
|grep <folder name>

Append this to sum folder sizes
|awk '{ SUM += $1 } END { print SUM/1024/1024 }'

find <root folder> -type d -exec du -s {} \; |grep <subfolder pattern> |awk '{ SUM += $1 } END { print SUM/1024/1024 }'


Popular posts from this blog