<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to find how many folders and documents are present in a site? in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110886#M31004</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With this web script, i'm only getting count of&amp;nbsp;folders in document library not their sub folders, I need to get the sub-folders count also included, sorry din't mention it before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jul 2019 05:12:28 GMT</pubDate>
    <dc:creator>madhu_sudireddy</dc:creator>
    <dc:date>2019-07-18T05:12:28Z</dc:date>
    <item>
      <title>How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110881#M30999</link>
      <description>How to&amp;nbsp;find how many folders and documents are present in a site?Can someone please help with this?</description>
      <pubDate>Tue, 16 Jul 2019 05:23:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110881#M30999</guid>
      <dc:creator>madhu_sudireddy</dc:creator>
      <dc:date>2019-07-16T05:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110882#M31000</link>
      <description>&lt;P&gt;You can use this webscript to get list.(inbuilt webscript)&lt;/P&gt;&lt;P&gt;&lt;A href="https://localhost:8080/alfresco/s/slingshot/doclib/doclist/documents/site/demo/documentLibrary?filter=all" target="_self" rel="nofollow noopener noreferrer"&gt;https://localhost:8080/alfresco/s/slingshot/doclib/doclist/documents/site/{siteid}/documentLibrary?filter=all&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You can create custom webscript to list folder.&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.alfresco.com/5.2/concepts/ws-folderListing-intro.html" target="_blank" rel="noopener nofollow noreferrer"&gt;https://docs.alfresco.com/5.2/concepts/ws-folderListing-intro.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 05:52:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110882#M31000</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2019-07-16T05:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110883#M31001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If alfresco has a web script for getting number of folders in a site, can you please share?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2019 09:55:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110883#M31001</guid>
      <dc:creator>madhu_sudireddy</dc:creator>
      <dc:date>2019-07-16T09:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110884#M31002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #727174; background-color: #ffffff; border: 0px;"&gt;This should do:&amp;nbsp;&lt;A class="" href="http://localhost:8080/alfresco/service/slingshot/doclib/doclist/node/site/{siteId}/documentlibrary/" rel="nofollow noopener noreferrer" style="color: #0d47a1; border: 0px; font-weight: inherit; text-decoration: underline; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;http://localhost:8080/alfresco/service/slingshot/doclib/doclist/node/site/{siteId}/documentlibrary/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2019 16:23:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110884#M31002</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-07-16T16:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110885#M31003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just put in Alfresco Share Search. For documents:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SITE:"shortsitename" and TYPE:"cm:content"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For folders:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;SITE:"shortsitename" and TYPE:"cm:folder"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number of documents&amp;nbsp;or folders is shown in the first page of the results of the search. You can use only TYPE: if you select SITE context in Alfresco Search or selecting site facet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use REST API too:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.zylk.net/es/web-2-0/blog/-/blogs/listing-thousands-of-noderefs-with-alfresco-rest-api" rel="nofollow noopener noreferrer"&gt;https://www.zylk.net/es/web-2-0/blog/-/blogs/listing-thousands-of-noderefs-with-alfresco-rest-api&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards.&lt;/P&gt;&lt;P&gt;--C.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jul 2019 07:18:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110885#M31003</guid>
      <dc:creator>cesarista</dc:creator>
      <dc:date>2019-07-17T07:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110886#M31004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With this web script, i'm only getting count of&amp;nbsp;folders in document library not their sub folders, I need to get the sub-folders count also included, sorry din't mention it before.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2019 05:12:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110886#M31004</guid>
      <dc:creator>madhu_sudireddy</dc:creator>
      <dc:date>2019-07-18T05:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110887#M31005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For that type of structure,you have to create your own script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2019 07:21:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110887#M31005</guid>
      <dc:creator>sp2</dc:creator>
      <dc:date>2019-07-18T07:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110888#M31006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is only giving the folders in document library&amp;nbsp;not sub folders , can you provide me the script for sub folders count also.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jul 2019 07:47:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110888#M31006</guid>
      <dc:creator>raju_gonda</dc:creator>
      <dc:date>2019-07-23T07:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110889#M31007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result of document count using the&amp;nbsp;webscript you have sent me is showing max 1000 counts only, is there any way to get the correct count(i.e more than 1000).&lt;/P&gt;&lt;P&gt;The sites with under 1000 document is showing correct count.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Jul 2019 10:13:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110889#M31007</guid>
      <dc:creator>madhu_sudireddy</dc:creator>
      <dc:date>2019-07-26T10:13:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110890#M31008</link>
      <description>&lt;P&gt;How can one use this api in java code, I have similar kind of requirement and I tried calling this api through the code but could not achieve this due to authentication issue(401 error).&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 07:21:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110890#M31008</guid>
      <dc:creator>Sanjana_17</dc:creator>
      <dc:date>2019-11-22T07:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110891#M31009</link>
      <description>&lt;P&gt;Create a javascript of java backed webscript. Write search query that will take siteshortname and object type (your custom content type, custom folder type, cm:content, cm:folder etc.) and performs a search and returns the count.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is a high level code which you can implement in your java backed webscript:&lt;/P&gt;

&lt;PRE&gt;&lt;STRONG&gt;&lt;U&gt;
   Query would be something like: 	  
&lt;/U&gt;&lt;/STRONG&gt;   
   String countQuery = 'PATH:"/app:company_home/st:sites/cm:' + search.ISO9075Encode(siteShortName) + '//*" AND TYPE:"'+type+'"';
   Where siteShortName and type you will pass for getting the related results.
   
&lt;STRONG&gt;&lt;U&gt;   You will below sample method to get the count and use it whereever you want:
&lt;/U&gt;&lt;/STRONG&gt;   
   long countResult = getObjectCount(countQuery);

	public long getObjectCount(String query) {
		SearchParameters searchParameters = new SearchParameters();
		searchParameters.setQuery(query);
        searchParameters.setLanguage(SearchService.LANGUAGE_LUCENE);
        searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
        searchParameters.setMaxItems(Integer.MAX_VALUE);
        searchParameters.setMaxPermissionChecks(Integer.MAX_VALUE);
		ResultSet results = null;
		long objectCount = 0;
		try {
			results = searchService.query(searchParameters);
			if (null != results) {
				objectCount = results.getNumberFound();
			}
		} catch (AlfrescoRuntimeException alfException) {
			LOGGER.error(alfException.getMessage(), alfException);
		} finally {
			if (results != null) {
				results.close();
			}
		}
		return objectCount;
	}&lt;/PRE&gt;


&lt;P&gt;&lt;U&gt;For javascript you can refer below sample and customize as per your need:&lt;/U&gt;&lt;/P&gt;


&lt;PRE&gt;&amp;lt;webscript&amp;gt;
&amp;lt;shortname&amp;gt;Count Files/folder&amp;lt;/shortname&amp;gt;
&amp;lt;description&amp;gt;
Counts Objects of given type

Parameter name : {type}
Example : custom:contentType, cm:content, cm:folder etc.

Parameter name : {siteShortName}
Example : test-site
&amp;lt;/description&amp;gt;
&amp;lt;url&amp;gt;/countObjects?type={type}&amp;amp;amp;siteShortName={siteShortName}&amp;amp;amp;skipCount={skipCount}&amp;amp;amp;maxCount={maxCount}&amp;lt;/url&amp;gt;
&amp;lt;format&amp;gt;any&amp;lt;/format&amp;gt;
&amp;lt;/webscript&amp;gt;&lt;/PRE&gt;
&lt;PRE&gt;function main(){

	var siteCount = [];
	
	var type = args["type"];
	var siteShortName = args["siteShortName"];
  
	var skipCount = (args["skipCount"]==null || args["skipCount"]==undefined)?0:args["skipCount"];
	var maxCount = (args["maxCount"]==null || args["maxCount"]==undefined)?100000:args["maxCount"];
   
      var countQuery = 'PATH:"/app:company_home/st:sites/cm:' + search.ISO9075Encode(siteShortName) + '//*" AND TYPE:"'+type+'"';
      logger.log("CountQuery: "+countQuery);
		
      var page = {
			skipCount : parseInt(skipCount),
			maxItems : parseInt(maxCount)
	  };
      
      var searchQuery = {
		  query : countQuery,
		  language : "lucene",
		  page : page
	  };
      
	  var nodes = search.query(searchQuery);      
      var nodeCount = nodes.length;
	  siteCount[siteShortName] = nodeCount;	
  
      model.siteCount=siteCount;
}

main();&lt;/PRE&gt;


&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;PRE&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Count of a given type&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;h4&amp;gt;Count of the given objects&amp;lt;/h4&amp;gt;&lt;BR /&gt;&amp;lt;b&amp;gt;Count Query:&amp;lt;/b&amp;gt; &amp;lt;#if query??&amp;gt;${query}&amp;lt;#else&amp;gt;-&amp;lt;/#if&amp;gt;&amp;lt;br/&amp;gt;&lt;BR /&gt;&amp;lt;hr/&amp;gt;&lt;BR /&gt;&amp;lt;#if siteCount?is_hash_ex&amp;gt;&lt;BR /&gt;&amp;lt;table border="1"&amp;gt;&lt;BR /&gt;&amp;lt;tr&amp;gt;&lt;BR /&gt;&amp;lt;th align="center"&amp;gt;Site Short Name&amp;lt;/th&amp;gt;&lt;BR /&gt;&amp;lt;th align="center"&amp;gt;Count&amp;lt;/th&amp;gt;&lt;BR /&gt;&amp;lt;/tr&amp;gt;&lt;BR /&gt;&amp;lt;#assign keys = siteCount ?keys&amp;gt;&lt;BR /&gt;&amp;lt;#list keys as key&amp;gt;&lt;BR /&gt;&amp;lt;tr&amp;gt;&lt;BR /&gt;&amp;lt;td align="center"&amp;gt;${key}&amp;lt;/td&amp;gt;&lt;BR /&gt;&amp;lt;td align="center"&amp;gt;${siteCount [key]}&amp;lt;/td&amp;gt;&lt;BR /&gt;&amp;lt;/tr&amp;gt;&lt;BR /&gt;&amp;lt;/#list&amp;gt;&lt;BR /&gt;&amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/#if&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 14:56:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110891#M31009</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2019-11-22T14:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to find how many folders and documents are present in a site?</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110892#M31010</link>
      <description>&lt;P&gt;Thank you for the revert.&lt;/P&gt;&lt;P&gt;I was able to count records in a datalist with this approach(Java backed code).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also wanted to calculate total size of the datalist in terms of MB/GB(based on amount of records present). What are the possible methods which will return this result. Also, for document library how can I caculate the total number of files and folder count alongwith total size of documentlibrary present using java code. (required for a timer job)&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 17:04:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/how-to-find-how-many-folders-and-documents-are-present-in-a-site/m-p/110892#M31010</guid>
      <dc:creator>Sanjana_17</dc:creator>
      <dc:date>2019-11-25T17:04:40Z</dc:date>
    </item>
  </channel>
</rss>

