Loading

Rename exported attachments or document files

Data pubblicazione: Aug 20, 2023
Descrizione

When you select "Include images, documents, and attachments" in your Data Export, you will notice that all the attachments are exported into an Attachments subfolder, and that they are named according to their associated 18-digit Salesforce ID and not the file name or extension. In order to identify the name and file type, you need to consult the Attachment.csv file also included in the data export. 

It is possible to rename the files back to the original file name using a batch file. 

See also
Rename and convert exported Chatter files, content, and feed attachments
Rename downloaded documents on a Mac
How to Video: How to Rename Exported Attachments or Document Files on a Mac
 
Risoluzione
Note
The 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&""""
 
  1. The resulting cell should look like this: RENAME 00P300000046RlaEAE "Technical Specifications V1_2.docx" 
Note: If multiple rows have the same filename, please append a number on its end (e.g. Document1.docx, Document2.docx, Document3.docx). You can't have multiple files with the same combination of filename and file extension within the same directory in Windows.
 
  1. Double-click the lower right corner of cell C2 to copy all the way down to column C.
  2. Select column C and copy it. 
  3. Open Notepad. 
  4. Paste the copied cells into Notepad. 
  5. 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.
  6. Navigate to your exported Attachments directory and double-click "Fix.bat". It should rename all the Attachments appropriately. 
  7. 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.
 
Notes:
 
  • If you 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, you will 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:
 
1. Go to:
Salesforce Classic: Setup | Data Management | Data Export
Lightning Experience: Gear icon | Setup | Data | Data Export

2. Select these boxes: "Include images, documents, and attachments" and "Include Chatter files and Salesforce CRM Content document versions." 

3. Instead of "Include All Data", select "ContentVersion." 
  • If there are attachments that are not converted, it means that the attachment have the same file name inside the folder. To convert the remaining unconverted attachments, create a new folder and copy the unconverted attachments and the fix.bat file to that new folder. Double click the fix.bat file again. Repeat the process on all Attachment/Document folders until all attachments/documents are converted.
  • Once you have the resulting export reference the article: Rename and convert exported Chatter files, content, and Chatter feed attachments for instructions on converting Chatter Files.
  • If there are many attachments with the same name, instead of creating multiple folders, one workaround is to add a suffix (Example - Number) to the file name using Excel and make each file name unique. If you are suggesting this technique to the customer, ensure that they save the details on the file, so that they can reference them back to the correct id.
  • If you will be renaming Content version, look for the Content Version.csv and combine the columns "ID" and "Path on client" to rename exported files inside Content Version folder. We suggest to replace .snote to .txt extension for you to be able to open the file in your computer.
Numero articolo Knowledge

000385467

 
Caricamento
Salesforce Help | Article