Print this page

Renaming exported Attachments/Documents files in a data export

Knowledge Article Number 000007269
Description When requesting a Full Data Export, you will notice that all attachments are placed in the Attachments subfolder and named with their Salesforce ID, not the actual file name or extension. One must then consult the Attachment.csv file included in the data export to find the name associated with the ID and rename the file. Salesforce ID for Attachments has an 18-character code that begins with "00P" and "015" for Documents each with their own .csv and folder.
NoteThe solution below is provided as a courtesy and point of reference but is not directly supported by Salesforce. Please note that it falls outside the scope of Support's boundaries to modify customer data, so implementation, troubleshooting and the function of the following will need to be performed and managed locally.

The following steps can be taken on a Windows based machine where the user should have Admin privileges to rename the records,  these steps are for Attachments but, they should be easily modified for other types of records:
1.Open the file "Attachment.csv" in Excel 
2.Delete all columns but "ID" and "Name". Once all the other columns are deleted, "ID" should be in column A and "Name" should be in column B. 
3.Copy the formula on the following line and paste it into cell C2. 
="RENAME "&A2&" """&B2&""""
4.The resulting cell should look like this: 
RENAME 00P300000046RlaEAE "Technical Specifications V1_2.docx" 
5.Double-click the lower right corner of cell C2 to copy all the way down to column C.
6.Select column C and copy it. 
7.Open Notepad. 
8.Paste the copied cells into Notepad. 
9.Click File|Save in Notepad, and save the file in your exported Attachments Folder as "Fix.bat" (without the quotation marks).  This is where the records to be renamed are located.
10.Navigate to your exported Attachments directory and double-click "Fix.bat". It should rename all the Attachments appropriately. 
11.Close "Attachment.csv" in Excel without saving any changes.

In summary, these steps help you generate a text file that uses the system's rename command to go through the output files and rename them back to their original state.

If customers want to mass update document file names, please consider the following caveat:  For documents.csv, if you review "Name" column, you'll notice that most document names do not contain file extension.  The file extension is found in "Type".  This is working as designed as Document name records in Salesforce do not retain extension in name field.  Therefore, customers need to update document.csv file to include file extension in the "Name" column or concatenate "Name" + "Type" into a new column.  The file extension is required for files to be clickable.

To rename Content including Chatter files and feed attachments you can Export the required files by navigating to:

Your Name,  Setup | Data Management | Data Export | Check these boxes: "Include images, documents, and attachments" and "Include Chatter files and Salesforce CRM Content document versions." Instead of "Include All Data" | Check the box for "ContentVersion"

Once you have the resulting export reference the article: How can I rename and convert exported Chatter Files and Chatter Feed Attachments? for instructions on converting Chatter Files.

promote demote