Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to query all empty folders in AEM DAM?

Avatar

Level 6

Is there a way to query all empty folders in AEM DAM.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
 

According to https://docs.jboss.org/author/display/MODE50/JCR-SQL2#JCR-SQL2-SinceModeShape4.0: it is not possible to query nodes with no children in JCR-SQL2.

You must write a simple groovy script to get all the folders node and check if there is a child node or not.

 

Although in SQL2 you can get nodes with children node using joins



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor
 

According to https://docs.jboss.org/author/display/MODE50/JCR-SQL2#JCR-SQL2-SinceModeShape4.0: it is not possible to query nodes with no children in JCR-SQL2.

You must write a simple groovy script to get all the folders node and check if there is a child node or not.

 

Although in SQL2 you can get nodes with children node using joins



Arun Patidar

Avatar

Community Advisor

@jezwn You can probably use the Asset API- http://localhost:4502/api/assets.json

and traverse the nodes and look for properties(total). However, this may not be a go-to approach. Groovy would be better.