Google Drive Duplicate Files
Resolution Checklist
- 1 Understand what triggers duplicate files in Google Drive
- 2 Deconflict multi-client sync loops and third-party tools
- 3 Locate and remove duplicates on Windows (PowerShell)
- 4 Locate and remove duplicates on macOS (Terminal)
- 5 Summary Checklist for Resolving Duplicates
Google Drive Duplicate Files
It can be highly frustrating when Google Drive duplicates files, creating multiple versions of documents, spreadsheets, or images. These duplicates typically append suffixes like ” (1)”, ” (Copy)”, or the editor’s username to the filename.
This guide explains the underlying causes of synchronization duplication and provides automated terminal scripts to clean up duplicate files on Windows and macOS.
1. Understand What Triggers Duplicate Files in Google Drive
File duplication in Google Drive occurs when the sync engine cannot confidently merge conflicting copies. This is caused by:
- Offline Collaboration Race Conditions: If you edit a file on Google Drive for Desktop while offline, and another user edits the same file online, Google Drive will not overwrite either set of changes. Instead, it uploads your offline version as a duplicate to preserve data.
- Multiple Sync Client Collisions: Running Google Drive for Desktop alongside third-party backup software (like Synology Cloud Sync, GoodSync, or FreeFileSync) causes both services to fight for file writes. One client uploads, the other downloads, resulting in a loop that creates duplicates.
- Local Index Desynchronization: If the DriveFS cache database crashes or fails to update, it may lose track of whether a file was uploaded. During the next sync cycle, it treats the local file as new and uploads it again, generating duplicates.
2. Deconflict Multi-Client Sync Loops and Third-Party Tools
To prevent future duplicates from appearing:
- Disable Competing Sync Services: If you use third-party cloud aggregators or local NAS backups, configure them to run on a set schedule (e.g., once a day) rather than using continuous real-time sync.
- Turn Off Offline Office Sync on Multiple Devices: If you are the only user editing files, ensure you don’t leave Microsoft Office documents open on multiple computers. When you switch devices, Google Drive detects the open lock file and creates duplicate recovery files.
- Purge the Sync Engine Cache: If the duplicates are caused by an internal database loop, kill Google Drive and clear the database:
- Windows:
rmdir /s /q "%USERPROFILE%\AppData\Local\Google\DriveFS" - macOS:
rm -rf ~/Library/Application\ Support/Google/DriveFS
- Windows:
3. Locate and Remove Duplicates on Windows (PowerShell)
You can run an automated PowerShell script to scan your Google Drive folders, detect files containing the (1) suffix, verify if the original file exists, and remove the duplicates.
Step 1: Terminate the Google Drive Client
Before running cleanup scripts, close Google Drive to prevent file-system lock conflicts:
taskkill /f /im googlepackagedexe.exe
Step 2: Run the PowerShell Cleanup Script
- Open the Start menu, type PowerShell, and click Run as Administrator.
- Run the following script (assuming your virtual Google Drive is mounted on drive
G:; adjust the path if yours is different):$drivePath = "G:\My Drive" Get-ChildItem -Path $drivePath -Recurse -File | Where-Object { $_.Name -match "\s\(1\)\.[a-zA-Z0-9]+$" } | ForEach-Object { $duplicateFile = $_.FullName $originalFile = $_.FullName -replace "\s\(1\)(?=\.[a-zA-Z0-9]+$)", "" if (Test-Path $originalFile) { Write-Host "Removing duplicate: $duplicateFile" -ForegroundColor Yellow Remove-Item -Path $duplicateFile -Force } else { Write-Host "Keeping duplicate (Original missing): $duplicateFile" -ForegroundColor Cyan } } - Relaunch Google Drive. The client will sync the deletions online.
4. Locate and Remove Duplicates on macOS (Terminal)
On macOS, you can use the Terminal and find utilities to recursively scan your local Google Drive directory for duplicate files.
Step 1: Stop the Google Drive client
killall "Google Drive"
Step 2: Execute the Shell Cleanup Script
- Open Terminal.
- Run this script to find and delete duplicates (retaining files where the original does not exist):
# Define the Google Drive local directory (FileProvider path) TARGET_DIR="$HOME/Library/CloudStorage" find "$TARGET_DIR" -type f -name "* (1).*" | while read -r duplicate; do # Construct the name of the original file by removing " (1)" original=$(echo "$duplicate" | sed 's/ (1)\././') if [ -f "$original" ]; then echo "Removing duplicate: $duplicate" rm -f "$duplicate" else echo "Keeping duplicate (Original missing): $duplicate" fi done - Relaunch Google Drive from the Applications folder.
5. Summary Checklist for Resolving Duplicates
| Checkpoint | Target Path / Command | Expected Outcome |
|---|---|---|
| Verify Sync Setup | System Tray / Settings menu | Disables redundant real-time sync engines. |
| Windows Process Kill | taskkill /f /im googlepackagedexe.exe | Suspends active syncing before file deletion. |
| Windows Cleanup | PowerShell Remove-Item script on G:\ | Recursively purges (1) duplicates with safety checks. |
| macOS Process Kill | killall "Google Drive" | Pre-empts Finder sync locks during script run. |
| macOS Cleanup | Terminal find + rm script on CloudStorage | Safely removes duplicate files in Mac CloudStorage. |
| Reset Index | Purge the DriveFS folder | Eliminates internal client database corruption loops. |