Deleting more than one attachment at a time?

Is there a faster way to delete topic attachments? In our 5.0 version, you can only delete one attachment at a time !@#$%^&

3 answers

Not that I know of. It is frustrating. If I have to delete a lot of attachments, I copy out the content on the page temporarily, and then delete the page, followed by creating a new page with the same content, reattaching the attachments I want. Not a great solution, but sometimes faster.

Hi Jerry,

Thank's for the idea. We will add this feature to our Page Tree Eraser. In the mean time you could use our Page Tree Creator to copy the page tree without attachments, delete the original and move the copied back. Yes, for the moment it's a ugly work around.


0 vote
Stephen Deutsch Community Champion Oct 27, 2016

There's some custom HTML you can add that will allow you to delete up to 20 attachments at a time. The code is in this JIRA ticket's comments, but I will also copy it to this page:

AJS.toInit(function() {
  if ( AJS.Meta.get('is-space-admin') || jQuery('#space-admin-link').length > 0 ) {
    if ( window.location.href.indexOf("viewpageattachments.action") >= 0 && jQuery(".removeAttachmentLink").length > 1 ) {
      jQuery('tr[id^="attachment-"]').each(function() {
        var attachmentId = jQuery(this).attr("id").substring(11);
        jQuery(this).find(".removeAttachmentLink").parent().after('<li><input type="checkbox" class="bulk-attachment-delete" name="' + this.getAttribute("data-attachment-filename") + '" value="' + attachmentId + '"></li>');
      jQuery('table.attachments th.actions-column').css('text-align','right').css('width','220px');
      jQuery('th.actions-column').html('<input type="checkbox" onclick="if (this.checked) { jQuery(\'.bulk-attachment-delete\').attr(\'checked\',\'checked\') } else { jQuery(\'.bulk-attachment-delete\').removeAttr(\'checked\') }"> ');
      jQuery('#download-all-link').css('display','inline-block').after('<a href="#" title="Delete all selected attachments" style="display:inline-block;float:right;padding-right:20px;margin-top:10px;padding-left:20px;background:url(\'data:image/gif;base64,R0lGODlhEAAQAKIAAHBwcOTk5Hh4eP///4GBgZOTkwAAAAAAACH5BAAHAP8ALAAAAAAQABAAAAMpOLrcPiAC8RhV1wnJY8Yd91UkFEbPiToqkKrvGYdz9xAn8QRFVwQlUgIAOw==\') no-repeat left center;" onclick="removeAttachments(jQuery(\'.bulk-attachment-delete:checkbox:checked\'));return false;">Delete Selected Attachments</a>');
var removeAttachments = function(checkboxes) {
  var confluenceVersion = parseFloat(AJS.params.versionNumber.substring(0,3));
  var doRemoveAttachments = function(checkboxes) {
    if (checkboxes.length) {
      var currentCheckbox = checkboxes.pop();
      if ( confluenceVersion >= 5.5 ) {
          type: 'DELETE',
          url: contextPath + '/rest/api/content/' + currentCheckbox.value,
          success: function(response) {
      } else {
        jQuery.ajax({dataType: 'json',
          contentType: 'application/json',
          type: 'POST',
          url: contextPath + '/rpc/json-rpc/confluenceservice-v2/removeAttachment',
          data: '[' + AJS.params.pageId + ',"' + + '"]',
          success: function( response ) {
            if (response == true) {
    } else {
  var dialog = new AJS.Dialog({
    width: 400,
    height: 170,
    id: "areyousure-dialog",
    closeOnOutsideClick: true
  dialog.addHeader("Are you sure?");
  dialog.addPanel("Panel 1", "<p>You are about to delete " + checkboxes.length + " attachments. Continue?</p>", "panel-body");
  dialog.addButton("OK", function (dialog) {
    if (checkboxes.length > 0) {
  dialog.addLink("Cancel", function (dialog) {

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,233 views 23 10
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you