Hi,We need to delete about 60000 imageassets (imported from inriver) for a specific type from the web and cm database.
Anyone have any code or sql script for a this operation?
Commerce version: 9.24.1
(yeah, I know we should upgrade, but thats another story...)
hi, do you care about database only or filesystem as well?
Just the easiest way of getting rid of all the inriver assets, so that I can re import everything from inriver.
My issue is that some months ago we deleted alle product and items, and as we see now, the linked assets were not deleted, just unlinked in the database. When we now try to import pictures for some of the products, with the same filename, the importcontroller gives an exeception of some kind that the image seo url is already occupied by some other content, so it can't import and link the image. And when I look in the database I see that the old assets existst in the content tables, version tabels and so on.
So instead of writing a rather complex sql to delete alle the assets, I live in hope that there are an easier and less risky way of deleting all the resources. If not, maybe someone already have written a sql for a similar purpose.
You would have to write code to delete them, probably by iterating over all products https://leanpub.com/epicommercerecipes/read_sample and then delete each asset in their CommerceMediaCollection (assets are basically content so just use IContentRepository as usual)
It's not fast, but it is the safest way to go
Ok, I built something that will iterate through all assets of a specific type in the blockfolders and delete them. Pretty slow though, but a one-time job, so I guess its ok for now.