Skip to content

Instantly share code, notes, and snippets.

@espenmn
Last active March 17, 2023 14:54
Show Gist options
  • Select an option

  • Save espenmn/cb7e3923e46b145dc7fcb8ee4833c9bf to your computer and use it in GitHub Desktop.

Select an option

Save espenmn/cb7e3923e46b145dc7fcb8ee4833c9bf to your computer and use it in GitHub Desktop.
# bin/instance run find_macfiles.py -O skipshistorie
import plone.api
from zope.component.hooks import setSite
setSite(app['skipshistorie'])
for brain in app.skipshistorie.portal_catalog(id="ds_store"):
obj= brain.getObject()
print('deleting')
try:
plone.api.content.delete(obj)
except Exception as e:
print(f"Error deleting object {obj.absolute_url()}: {e}")
import transaction ;
transaction.commit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment