Deleting Old Packages with the Packages API

Sorry if this has been covered before, but I am curious if there is a simple way to delete multiple old packages from various projects. Going through one by one to delete packages that are old & no longer needed is tedious. I would like to be able to delete packages that are older than 1 week.

Thanks in advance

Probably easiest, would be to use the Packages API command explained here: Packages API | GitLab

You would need to script it, perhaps utilise the created_at field from the package list command, and then based on the result of that use the package delete command to delete the packages.