Each client project is in a space and when the project is over, we need to be able to have them download the attachments without going page by page. The Pages we can export to one PDF file but no solution for attachments.
Hello @Angie Affolter - it's still pretty manual, but better than exporting page by page. I see two options:
Option 1 (formats space and supported attachments as pages)
Option 2 (manual export of each attachment)
Please let me know if this resolves your issue, or if you have additional questions!
Thanks! That's what I was doing. I was hoping for a more user-friendly answer.
My IT guys found this info - not end user but might be a good alternative:
https://community.atlassian.com/t5/Confluence-questions/Export-spaces-and-attachments/qaq-p/135920
https://bobswift.atlassian.net/wiki/spaces/CSOAP/pages/177373303/How+to+download+all+attachments+for+a+space
PDF shows this on the version of Confluence I am using. 7.4.7. is there an option to get the attachments?
Hello @Victor Prasad ,
you can export as XML and you will get also the attachments in the export.
I will just add that if you want the files to be separately as files you can do that and ensure they have descriptive names. (and not face a problem with PDF export with certain types of attachments due to embed) there is another way.
import osimport xml.etree.ElementTree as ET# Path to the directory where the files are saveddirectory_path = r"path\to\html\export\attachments\folder"# Path to the XML filexml_file_path = r"path\to\file.xml"# Parse the XML filetree = ET.parse(xml_file_path)root = tree.getroot()# Create a dictionary to store file IDs and real namesfile_dict = {}# Extract file IDs and real names from the XMLfor attachment in root.iter('object'):attachment_class = attachment.attrib.get("class")if attachment_class == "Attachment":file_id = attachment.find("./id[@name='id']").textreal_name = attachment.find("./property[@name='title']").textfile_dict[file_id] = real_name# Rename files in placefor root_folder, _, files in os.walk(directory_path):# Create a dictionary to track counts of each file name in a directory name_count = {}for filename in files:file_id, file_extension = os.path.splitext(filename)# Check if the file ID exists in the dictionary if file_id in file_dict:real_name = file_dict[file_id]base_name, ext = os.path.splitext(real_name)# Check if the file name already exists in the directory if base_name in name_count:name_count[base_name] += 1 new_base_name = f"{base_name}_{name_count[base_name]}" else:new_base_name = base_namename_count.setdefault(base_name, 1)new_name = f"{new_base_name}{ext}" old_path = os.path.join(root_folder, filename)new_path = os.path.join(root_folder, new_name)# Rename the file os.rename(old_path, new_path)print(f"Renamed: {old_path} -> {new_path}")
It looks like you're new here. Sign in or register to get started.