I have the following structure in my Sitecore media library
images/department/sub-department/product/
And I want to delete all of the images in code a department at a time. At the moment I have
Item[] items = database.SelectItems("/sitecore/media library/images/department1//*");
Sitecore.Data.Engines.DataEngine engine = new Sitecore.Data.Engines.DataEngine(database);
using (new SecurityDisabler())
{
foreach (Item item in items)
{
engine.DeleteItem(item))
}
}
The problem is it only deletes the child images of department1 and nothing underneath that?