Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
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.