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

0 votes
Bill Bailey Community Champion Oct 19, 2016

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.


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
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,174 views 2 13
Read article

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