Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

How to query all empty folders in AEM DAM?

Avatar

Level 7

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

AEM LinksLinkedIn

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

AEM LinksLinkedIn

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.