The OneDrive “Scanning Files” infinite loop occurs when the OneDrive desktop sync client gets stuck trying to index your local directory against the cloud metadata catalog. When this happens, the taskbar icon displays a continuous spinning arrow or cycling status, high CPU usage often spikes in Task Manager, and no actual file syncing progresses.
Fast Fix:
Restart the client and clear stuck file locks. Right-click the OneDrive cloud icon in the system tray, select Pause syncing > 2 hours, wait 10 seconds, then select Resume syncing. If the scan remains stuck, restart the OneDrive application or execute a client cache reset via the Run dialog (
Win + R) using%localappdata%\Microsoft\OneDrive\onedrive.exe /reset.
Diagnostic Snapshot
- Common Causes: Corrupted local metadata cache (
SyncEngine.odc), hidden zero-byte temporary files, file system permission blocks, or exceeding the 300,000 file-sync threshold. - Risk Level: Low risk of data loss, but local edits made during an active loop will not sync to Microsoft 365 cloud endpoints or other co-authors.
- Scope: Local client state; cloud data remains intact and accessible via the browser at OneDrive for Web.
Why the “Scanning Files” Loop Happens
When OneDrive starts or detects a change, its sync engine traverses local folders and compares file hashes, timestamps, and NTFS Change Journal records with the cloud database.
The process stalls into an infinite scan when:
- The local sync catalog is corrupted: The internal database cannot resolve an entry, causing the scanner to restart the indexing loop indefinitely.
- Orphaned temporary or hidden lock files exist: Office lock files (like
~$example.docx) or hidden.tmpfiles can trigger OneDrive Syncing “Temporary Files” (.tmp) by Mistake and prevent the indexer from completing its pass. - High item-count limits are breached: Syncing libraries containing more than 300,000 total items causes severe metadata enumeration overhead and thread exhaustion, as detailed in Troubleshooting “Syncing a Library that contains a lot of files”.
Step-by-Step Resolution
Follow these actions in order, from the least disruptive to deeper client-level resets.
1. Identify and Remove Problematic Hidden/Temp Files
Stuck temporary files often prevent the scanner from closing its transaction log.
- Open File Explorer and click View > Show > Hidden items.
- Navigate to your local OneDrive folder.
- In the search bar, type
~$*or.tmp. - If you locate orphaned temporary files from applications that are currently closed, move them out of the OneDrive directory to a local temporary folder or delete them.
- Close all active Office documents to release locks that cause How to Fix “Items can’t be synced because they are open” Loop.
2. Isolate the Stuck Directory
If a single subfolder has invalid permissions or corrupted attributes, temporarily excluding it will immediately break the loop.
- Click the OneDrive icon > Settings (gear icon) > Settings.
- Go to the Account tab and click Choose folders.
- Uncheck suspect top-level folders one at a time and click OK.
- If OneDrive completes the scan immediately after unchecking a folder, the root issue is inside that specific directory (such as unsupported characters, broken symlinks, or file paths exceeding limits, covered in Resolving “File Name is Too Long” OneDrive Sync Failures).
3. Reset the OneDrive Sync Engine Cache
Resetting the sync client rebuilds the local database without deleting your cloud or local personal files. For a full breakdown of switches, see How to Reset the OneDrive Sync Client (The Complete Command List).
- Press
Windows Key + Rto open the Run dialog box. - Paste the following command and press Enter:
%localappdata%\Microsoft\OneDrive\onedrive.exe /reset - The OneDrive icon will disappear from your system tray. If it does not restart automatically after 2 minutes, open Run again and execute:
%localappdata%\Microsoft\OneDrive\onedrive.exe - OneDrive will re-index your files. Give the client several minutes to run an initial clean scan.
When the Problem Persists: Advanced Scenarios
If the scanner continues looping after a cache reset, evaluate the following environments:
- Stuck in “Processing Changes” rather than Scanning: If the UI switches from “Scanning files” to calculating file lists without uploading, follow OneDrive Stuck on “Processing Changes” for Hours.
- Files-On-Demand Virtual Filter Conflicts: If you encounter error codes like
0x8007016Aduring the scan pass, the Windows Cloud Files Filter driver (cldflt.sys) may be out of sync. Review How to Fix OneDrive “0x8007016A” Cloud File Provider Error. - Enterprise Group Policies / Network Throttling: If you are on an enterprise machine connected over a restrictive corporate VPN, local network inspection tools can disrupt continuous hash validation and trigger Resolving OneDrive “Bandwidth Limit” Sync Throttling.
Next Diagnostic Steps
If a complete reset fails and the infinite scan returns immediately upon signing back in, your local Windows user profile’s cloud cache or NTFS filesystem records may be damaged. Run chkdsk C: /f from an administrative Command Prompt to resolve underlying file system index errors, or unlink and re-link your Microsoft 365 account under OneDrive Settings > Account > Unlink this PC.