Attachment Detection

Just a random Question:

The scenario:

I got a big page with loads of pictures.
I want to split the page in several subpages by coping the page
to preserve all the links to the attachments.

Is there any chance by default, to delete the picturelinks inside the
editor and have a auto detection of the orphaned attachments on that new page with
an autodelete possibiliy? The Pages are so heavily loaded with random picturenames
that doing that manually would be a desaster and time consuming like hell.

Or am i thinking to complicated and theres a workaround?


All of this can be done by using some scripting. You’d need to find the right APIs to call though :slight_smile:


  • get the XDOM (AST) of the page, find all the references to attachments
  • get the list of attachment for the page
  • compare and delete the attachments that are not used in the page

This can be done in about 5-10 lines of script.

i will try so, thx Vincent!