cancel
Showing results for 
Search instead for 
Did you mean: 

Need Alfresco share webscript to get the list of all sites,folder, files and space occupied by them.

anujsharma
Confirmed Champ
Confirmed Champ

Can anyone please share webscript to get the list of all sites,folder, files and the space occupied by them.

1 ACCEPTED ANSWER

kaynezhang
World-Class Innovator
World-Class Innovator

folder path parameter should be cn:name property,for example in my environment

http://localhost:8080/alfresco/s/dir/公司主页?verbose=true  (of course chinese character need to be encoded)will work

View answer in original post

13 REPLIES 13

Sorry , i was trying the wrong way
It worked now !!
Thanks !!

Just one more query

Can we get the individual size of each file and subfolders inside a folder

kaynezhang
World-Class Innovator
World-Class Innovator

There is a Java based WebScript in git hub that can calculate folder size ,you can evaluate if it safisfy your needs,if not you can do some customization.
https://github.com/dedunu/filesize-webscript

I have not tried any java based webscripts.

I am trying using javascript based webscripts 

The tutorial Developing a Folder Listing web script | Alfresco Documentation  is fullfilling my requirements 
It just need some customization for folder size

Below i have attached the html file in which there is a condition for getting the content size if child is 'document'

Can you please help me to get the size of individual subfolders inside a folder.

What changes should i do in the below code in order to get this ?


dir.get.html.ftl


dir.get.js

kaynezhang
World-Class Innovator
World-Class Innovator

I think you can write an recursive function to caculate size of folder in your dir.get.js like this. and for every sub folder call this function to caculate folder size,and then present it in dir.get.html.ftl

getNodeSize(node) {
var size = 0;

if(node.isDocument)
{
size=node.getSize();
}
else if(node.isContainer){
var children = node.children;
for (var i = 0; i < children.length; i++)
{
var child = children[i];
size = size + getNodeSize(child);
}
}else{
}
return size;
}

It is just an example ,I have not tested it ,and it has poor performance