As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
How to find the size of the folder in a site?
Please check this.It is used to add add size as folder metadata.
https://github.com/zhihailiu/alfresco-folder-size
You need to fetch content of every node inside folder and calculate the size.This will be recursively calculated.Thumbnail is also children of content node, if you would like to ignore thumbnail , you need to explicitly put same condition in code.
This code is in below file in addon mentioned by Sanjay Bandhniya
https://github.com/zhihailiu/alfresco-folder-size/blob/master/repo-amp/src/main/java/com/acme/nodesize/NodeSizeWebScript.java