general

Duplicate Files After Sync

Resolution Checklist

  • 1 Understand Conflicted Copy Suffixes
  • 2 Identify and Merge Duplicates on Windows
  • 3 Locate and Deduplicate Files on macOS
  • 4 Prevent Concurrent Mod Conflicts and Multi-Client Overlap
  • 5 Summary Quick Reference Checklist

Duplicate Files After Sync

“Duplicate Files After Sync” occurs when a cloud client synchronizes the same directory across multiple devices and detects conflicting changes. Instead of overwriting modifications, the sync engine creates a duplicate file containing the device name or words like “conflicted copy”, “Copy”, or numbers (e.g., Document-PC-Name.docx or Document (1).docx). This leads to directory clutter and version confusion.

This guide explains the causes of conflict copies, provides scripts to clean up duplicate files, and details strategies to prevent their creation on both Windows and macOS.


1. Primary Causes of Duplicate Sync Files

Duplicates are typically generated by:

  • Simultaneous Offline and Online Changes: Modifying a file on Device A while offline, while the same file is modified on Device B online. When Device A reconnects, a conflict is declared.
  • Multiple Active Sync Clients: Running two sync applications (e.g., Dropbox and OneDrive) pointing to the same physical folder, causing each to process changes in an infinite loop.
  • Time-Stamp Mismatches: Local clock drift causing the cloud server to misinterpret a file’s age, treating an older copy as a new concurrent version.
  • App Auto-Saves: Applications doing background saves to temporary directories that the sync client incorrectly uploads as permanent conflict files.

2. Identify and Merge Duplicates on Windows

On Windows, you can use PowerShell to list conflicted copies and purge them after verifying changes are merged.

A. List Conflicted and Duplicate Files

Search for common conflict naming patterns (e.g., -Copy, conflicted copy, -PCName):

  1. Search for PowerShell in the Start Menu and select Run.
  2. Run the following command to find conflict files:
    # Find files containing "conflicted" or ending with (1), (2), etc.
    Get-ChildItem -Path "$env:UserProfile\OneDrive" -Recurse | Where-Object {$_.Name -match "conflicted|(\(\d+\))|-copy"}

B. Delete Duplicate Conflict Files

Once you have verified that the main files are up-to-date, delete the duplicate copies:

# Delete the conflict files recursively
Get-ChildItem -Path "$env:UserProfile\OneDrive" -Recurse | Where-Object {$_.Name -match "conflicted|(\(\d+\))|-copy"} | Remove-Item -Force

(Warning: Review the files before deletion to ensure no unique edits are lost).


3. Locate and Deduplicate Files on macOS

On macOS, you can leverage terminal commands using find and regex to identify and delete duplicate files.

A. Find Conflict Copies in macOS Finder

  1. Open Terminal (via Spotlight).
  2. Scan your sync directory for files with common duplicate suffixes:
    # List duplicate files in your local CloudStorage directory
    find ~/Library/CloudStorage -type f \( -name "*conflicted*" -o -name "*copy*" -o -name "*(*)*" \)

B. Bulk Remove Sync Duplicates

Clean out the identified duplicates from the macOS file system:

# Delete all files containing 'conflicted copy' or '(1)' in their name
find ~/Library/CloudStorage -type f \( -name "*conflicted*" -o -name "*(*)*" \) -delete

4. Prevent Concurrent Mod Conflicts and Multi-Client Overlap

Avoid future duplicates by correcting user workflow patterns and client configurations.

Verify Time and Date Synchronization

If your system clock is off, the cloud server cannot determine the correct version sequence:

  • Windows: Run w32tm /resync in an Administrator Command Prompt.
  • macOS: Run sudo sntp -sS time.apple.com in Terminal.

Disable Multi-Sync Folder Overlap

Do not sync the same folder with multiple clients. If you sync ~/Documents with both OneDrive and iCloud:

  1. Open the preferences of one client (e.g. OneDrive).
  2. Go to Choose Folders or Backup.
  3. Toggle off the folders that are already managed by the other client (e.g., iCloud Desktop & Documents).

5. Summary Quick Reference Checklist

Action TargetOperating SystemTerminal Command / PathExpected Outcome
Search DuplicatesWindowsGet-ChildItem -Recurse | Where-Object...Locates files with “conflicted”, “(1)”, or “-copy” strings.
Purge DuplicatesWindowsGet-ChildItem... | Remove-Item -ForceDeletes all selected conflict duplicates.
Find macOS DuplicatesmacOSfind ~/Library/CloudStorage -type f...Lists duplicate structures in terminal output.
Purge macOS DuplicatesmacOSfind ~/Library/CloudStorage -type f... -deleteDeletes the duplicate files from the disk.
Sync System TimeWindowsw32tm /resyncEnsures accurate modification timestamps.
Sync System TimemacOSsudo sntp -sS time.apple.comRe-aligns NTP timestamps to avoid write conflicts.