Deleting large numbers of assets?

Hi,


I have got about 19k assets that need to be deleted and using a trigger (via a batch) that has a remove link action is only processing at less than 1 asset a second or slower.



Would anyone have any ideas on a faster way to delete such a large number of assets?



They are currently only linked under 1 parent folder asset, but due to a large number of other assets referring to the parent asset folder, I don't want to just drag the parent into Trash.



Even better would be any suggestions to avoid linking the assets to Trash first and completely unlinking them out of the asset tree.



thanks,



Maks.

[quote]
Hi,



I have got about 19k assets that need to be deleted and using a trigger (via a batch) that has a remove link action is only processing at less than 1 asset a second or slower.



Would anyone have any ideas on a faster way to delete such a large number of assets?



They are currently only linked under 1 parent folder asset, but due to a large number of other assets referring to the parent asset folder, I don't want to just drag the parent into Trash.



Even better would be any suggestions to avoid linking the assets to Trash first and completely unlinking them out of the asset tree.



thanks,



Maks.

[/quote]



Hi,



Running a script would be good option here. If you have Shell access you can try your hand on [SYSTEM_ROOT]/script/move_assets.php



Ash

Awesome, thanks Ash!


I missed that on my first look through the scripts folder as I was looking for "delete" or "remove" in the script names.



Going to try it right now…



Maks.


[quote]

Hi,



Running a script would be good option here. If you have Shell access you can try your hand on [SYSTEM_ROOT]/script/move_assets.php



Ash

[/quote]

Hi Ash,


Thanks very much for your help, have a followup question though :slight_smile:



now that I have approx 19K of assets in the Trash, is there an easy way to purge them?

purge_trash.php script is quite slow and has a transaction around the whole asset delete list, so that if you stop it part way through, none of the assets its already processed are actually purged from Trash.



Is there perhaps a SQL script that we could use instead?



I did notice that purge_trash.php is able to act only on 1 asset and its children, but unfortunately we did not move the large numbers of assets under separate subfolders in trash, but all directly linked under trash asset itself :frowning:



Any advice most appreciated.



thanks,

Maks.




[quote]

Hi,



Running a script would be good option here. If you have Shell access you can try your hand on [SYSTEM_ROOT]/script/move_assets.php



Ash

[/quote]

[quote]
Hi Ash,



Thanks very much for your help, have a followup question though :slight_smile:



now that I have approx 19K of assets in the Trash, is there an easy way to purge them?

purge_trash.php script is quite slow and has a transaction around the whole asset delete list, so that if you stop it part way through, none of the assets its already processed are actually purged from Trash.



Is there perhaps a SQL script that we could use instead?



I did notice that purge_trash.php is able to act only on 1 asset and its children, but unfortunately we did not move the large numbers of assets under separate subfolders in trash, but all directly linked under trash asset itself :frowning:



Any advice most appreciated.



thanks,

Maks.

[/quote]





Hi,

The purge trash script is the best option according to me. It would be a nit annoying since the transaction is around the entire list of assets rather than individual assets.

The normal SQL would remove the assets from thrash but it is likely it will still retain the entries for these assets in other tables. The Script here takes care that the entries for the forever deleted assets are removed from their respective tables. Say for example medatata or attribute value tables.



Can you not run the purge_trash script overnight or over the weekend. I am sure it wouldn't be that bad in terms of performing.



Ash

Thanks again Ash!


Yes I thought that it would be doing a fair amount of work cleaning up all refs to each link/asset across the sql tables.



Yes we're planning to run the purge_trash.php overnight (when no content editors will be stopped by the Trash lock) and hoping that it can get through them all in that time.



Lesson learned for next time - we'll make sure to use the move_assets.php script to move into subfolders under trash instead of trash itself :slight_smile:



Maks.

[quote]
Thanks again Ash!



Yes I thought that it would be doing a fair amount of work cleaning up all refs to each link/asset across the sql tables.



Yes we're planning to run the purge_trash.php overnight (when no content editors will be stopped by the Trash lock) and hoping that it can get through them all in that time.



Lesson learned for next time - we'll make sure to use the move_assets.php script to move into subfolders under trash instead of trash itself :slight_smile:



Maks.

[/quote]

No Worries Mate. Glad to help :slight_smile:



Ash