How do I delete empty folders(folders without any content) by using Artifactory AQL?
I have the current AQL query to find files that are older than 12w and never downloaded, which I will delete by an script.
items.find(
{
"repo":{"$eq":"libs-release-local"},
"stat.downloads":{"$eq":null},
"created":{"$before" : "12w"},
}
)
This leaves me with empty folders, how do I specify an AQL query that finds all empty folders?
From Artifactory Query Language documentation: if type is not specified in the query, the default type searched for is file.
By adding a type to the query you can control the result type: file, folder or both.
For example:
items.find(
{
"repo": {"$eq":"libs-release-local"},
"stat.downloads": {"$eq":null},
"created": {"$before" : "12w"},
"type": {"$eq":"any"}
}
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With