Can anyone please share webscript to get the list of all sites,folder, files and the space occupied by them.
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
Please visit http://serverort/alfresco/s/index/all and login with admin account.
This page will list all webscripts installed .
I am following the tutorial Developing a Folder Listing web script | Alfresco Documentation
But i am getting 404 folder not found error for Company Home as described here :
http status code 404 - Alfresco webscript can't find Company Home folder - Stack Overflow Stuck on this !!
Could you please attach your customized webscript here?
<html> <head> <title>Folder ${folder.displayPath}/${folder.name}</title> </head> <body> <p>Alfresco ${server.edition} Edition v${server.version} : dir</p> <p>Contents of folder ${folder.displayPath}/${folder.name}</p> <table> <#list folder.children as child> <tr> <td><#if child.isContainer>d</#if></td> <#if verbose> <td>${child.properties.modifier}</td> <td><#if child.isDocument> ${child.properties.content.size}</#if></td> <td>${child.properties.modified?date}</td> </#if> <td>${child.name}</td> </tr> </#list> </table> </body> </html>
dir.get.js // extract folder listing arguments from URI var verbose = (args.verbose == "true" ? true : false); var folderpath = url.templateArgs.folderpath; // search for folder within Alfresco content repository var folder = roothome.childByNamePath(folderpath); // validate that folder has been found if (folder == undefined || !folder.isContainer) { status.code = 404; status.message = "Folder " + folderpath + " not found."; status.redirect = true; } // construct model for response template to render model.verbose = verbose; model.folder = folder;
and
i am trying hitting the url : http://localhost:8080/alfresco/service/dir/{folderpath}?verbose={verbose?}
but getting the error
i have also tried with the url : http://localhost:8080/alfresco/service/dir/Company%20Home?verbose=true but getting the same error
Hi,
IMO the 404 tells us that your webscript is not correctly deployed on Alfresco.
Can you find your webscript using this URL : http://hostort/alfresco/service/index/uri/ ?
Yann
Webscript is correctly deployed
i am able to see the webscript after hitting this url
Please see the below image :-
Please can you tell how to browse to this page (the screenshot which you have given).
http://localhost:8080/alfresco/
click Alfresco Administration Console (admin only) and login with admin user.
in left tree click node browser.
Sorry , i was trying the wrong wayIt worked now !!Thanks !!Just one more queryCan we get the individual size of each file and subfolders inside a folder
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
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