Yeah, I tried it with --action test and it queued for example all jpg files inside my subfolders for deletion, regardless of other content that might be contained in the folder.
Anyway, thanks for the tip, I think I managed it now.... somehow!
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
I commented out line 49 and 52 and just did it all by altering the last line. I am no Java-Coder and I find this kind of code absolutely not human-readable, so please excuse my bland stupidity.
The code now checks on each folder, if it is a direct subfolder under the root directory
Code: Select all
it.getParent().equals("HARDCODED STRING TO MY PATH")
and then checks if all files in that folder are clutter, by checking if any file is non-clutter and negating the result
Code: Select all
!it.getFiles().find{ !isClutter(it) }
I couldn't figure out how to check getParent() against the passed /path/to/media, so I hardcoded it.
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Here's the complete line of code.
Code: Select all
args.getFolders().each { if (it.isDirectory() && it.getParent().equals("HARDCODED STRING TO MY PATH") && !it.getFiles().find{ !isClutter(it) }) { clean(it) } }