How to Move Salesforce Files and Attachments to External Storage

Salesforce is an excellent place to work with a document and an expensive place to keep one for ten years. File storage is allocated per org and per user license, extra capacity is sold at a premium, and the files that fill it are mostly ones nobody has opened since the deal closed. Moving them to storage you already pay for is one of the few Salesforce cost savings that needs no licence negotiation.

The catch is that "move" is two operations: a copy out, and a delete. The copy is safe. The delete is not reversible after fifteen days. This guide is ordered so that the irreversible step comes last, after proof.

First, What Salesforce Offers Natively

Admins often expect a setting for this. There are two related features, and neither moves existing files.

  • Files Connect surfaces files stored in SharePoint, OneDrive or Google Drive inside Salesforce. It is a window onto external storage. It does not push your existing Salesforce Files out to it.
  • Data Export Service produces a weekly ZIP set of everything. It is a copy, not an archive process: no filters, no folder structure, and 48 hours to download it. See data export limits.

AppExchange has connectors that offload files to cloud storage in real time. They suit orgs that want every new upload redirected automatically, at the price of a managed package, a subscription and a security review. For clearing out existing files, and for teams that would rather not add a package, the export-based process below needs neither.

Step 1: Measure What Is Using the Space

Open Setup → Storage Usage. Under file storage you will see separate lines for Files (Content), Attachments, Documents and others. Then find where they sit:

-- Classic attachments by parent object
SELECT Parent.Type, COUNT(Id) total
FROM Attachment GROUP BY Parent.Type ORDER BY COUNT(Id) DESC

-- Largest Salesforce Files
SELECT Title, FileExtension, ContentSize, CreatedDate
FROM ContentDocument ORDER BY ContentSize DESC LIMIT 200

Two patterns show up in most orgs. A small number of very large files, such as videos, design files and database dumps, account for a disproportionate share. And one or two objects, usually Case or EmailMessage, hold most of the count.

Step 2: Write Down the Archive Policy

Decide the rule before touching anything, and get the record owners to agree to it.

DecisionTypical answer
Which files move?Files on closed cases older than 2 years. Attachments on closed-lost opportunities. Anything over 50 MB.
Which stay?Anything on an open record. Anything used by an automation, email template or Experience Cloud site.
Where do they go?A SharePoint library, an S3 bucket, a NAS share.
How long are they kept there?Per your retention schedule, by record type.
Who can open them?Mirror the Salesforce access model as closely as the destination allows.
Access control does not travel with the file. A document that only the account team could see in Salesforce becomes visible to everyone with access to the destination folder. Set the permissions on the destination before the first file arrives.

Step 3: Export with the Record Structure Intact

An archive is only useful if someone can find the contract for a given account in three years. That requires the export to keep each file with its parent record.

SFDC File Exporter writes files into folders by object and record, and lets you express the policy from Step 2 directly:

Run it once for Files and once for Attachments. They are different objects, as explained in downloading all Salesforce attachments. Include Notes and Enhanced Notes if the policy covers them.

Step 4: Get the Files to Their Destination

The export writes to a folder on the machine. Getting from there to external storage uses tools you already have, which is why no connector is required.

DestinationHow
OneDrive / SharePointSet the output folder inside a synced library. The OneDrive client uploads as files arrive. Keep paths short: SharePoint limits the full path length to about 400 characters.
Google Drive, Dropbox, BoxSame approach with the desktop sync client.
Network share or NASPoint the output folder at the mapped drive, or export locally and copy with robocopy or rsync for a verifiable transfer.
Amazon S3Export locally, then aws s3 sync ./export s3://your-bucket/salesforce-archive/
Azure BlobExport locally, then azcopy sync to the container.

For large volumes, exporting to a local disk first and syncing second is faster and easier to verify than writing straight into a synced folder.

Step 5: Verify, Then Free the Space

  1. Reconcile counts. Files exported per object against the query results from Step 1, filtered the same way. Check the job history for failures.
  2. Confirm the upload. File count and total size at the destination match the local export.
  3. Spot-check. Open a sample across file types and years.
  4. Leave a pointer. Populate a URL or text field on each record with the archive location so users are not left with an empty related list and no explanation.
  5. Delete in batches. Use Data Loader with the exact ID list you exported: ContentDocument IDs for Files, Attachment IDs for attachments. Start with a small batch.
  6. Wait, then empty the Recycle Bin. Deleted files remain recoverable for 15 days and still count against storage until the bin is emptied. Use the window.
Deleting a ContentDocument removes it from every record it was shared with, not only the one you were looking at. Check for files linked to several records before deleting, using the ContentDocumentLink queries in our Files data structure guide.

Making It Routine

Storage fills again unless the archive runs regularly. Save the export as a scheduled job with incremental mode, pointed at the same destination, on a monthly cron. Keep deletion as a separate, reviewed step each quarter. The copy can be automatic. The delete should always have a person's name against it. More on scheduling in automating Salesforce file exports.

Frequently Asked Questions

How do I move files from Salesforce to external storage without a third-party connector?

Export the files to a local folder with a desktop export tool, then let your existing storage client carry them to their destination: a OneDrive or SharePoint synced folder, a mapped network drive, or a command-line sync to S3 or Azure Blob. Nothing is installed in Salesforce and no integration has to be built or approved.

Does Salesforce Files Connect move files out of Salesforce?

No. Files Connect lets users browse and reference files that already live in an external system such as SharePoint, OneDrive or Google Drive from inside Salesforce. It does not transfer existing Salesforce Files or Attachments to that system, so it does not reduce the storage you are already using.

Will deleting files in Salesforce free up storage immediately?

Not until the Recycle Bin is emptied. Deleted files and attachments stay in the Recycle Bin for 15 days and continue to count against file storage during that time. That window is also your safety net, so verify the archive before emptying it.

How can users find a file after it has been moved out of Salesforce?

Leave a pointer on the record. Common approaches are a URL field holding the folder link in SharePoint or OneDrive, or a short text field with the archive path. Because the export is organised by object and record, the folder for each record is predictable and the link can be built by formula.

Can I automate moving new Salesforce files to external storage?

Yes. Schedule an incremental export whose output folder is inside a synced or mounted external location. Each run downloads only files added since the last one, and the sync client uploads them. Deletion from Salesforce should remain a separate, deliberate step after verification.

Copy First, Delete Last

Offloading Salesforce files is low risk when the order is respected: measure, agree the rule, export with structure, upload, verify, and only then delete. Every step before the last can be repeated. Download SFDC File Exporter to run the export on a sandbox first, and talk to RASPSYS if you would like the archive process designed and run for you.

Move Old Files Out of Salesforce Storage

Export files and attachments to any folder your machine can reach, including synced SharePoint, OneDrive and network drives. Free for 50 files per export.