How to Count Files and Generate Reports in an Online-Only OneDrive Folder
Question details
The user needs to count thousands of online-only files, identify upload failures, and export a detailed list containing file paths, names, types, sizes, and modification dates from a folder that is not synced to the desktop.

- Product
- Microsoft OneDrive
- Device & OS
- not provided
- Scenario
- Auditing and generating metadata reports for a massive volume of cloud-only files without using local storage space.
- Observed behavior
- Because the folder is online-only and completely unsynchronized, it is invisible to the local operating system, preventing standard command-line tools like Windows PowerShell or Command Prompt from accessing or counting the files.
Ensure you have administrator access to your OneDrive account and a stable internet connection, as querying thousands of cloud files requires interacting directly with Microsoft servers.
Enable Folder Sync with Files On-Demand and Run PowerShell
By syncing the folder as placeholders using Files On-Demand, you make the file metadata visible to Windows without downloading the actual file contents, allowing PowerShell to generate reports.
This is the most reliable method for Windows users. Files On-Demand ensures that only file shortcuts (metadata) take up space on your hard drive, completely bypassing the need to download terabytes of data just to run a script.
Click the OneDrive cloud icon in your system tray, select the Gear icon (Settings), go to the 'Sync and back up' tab, click 'Advanced settings', and ensure 'Files On-Demand' is turned on.
In OneDrive Settings, navigate to 'Account' and click 'Choose folders'. Check the box next to your target online-only folder so it appears in your local File Explorer.
Open PowerShell as Administrator. Use the command: Get-ChildItem -Path 'C:\Users\YourName\OneDrive\YourFolder' -Recurse | Select-Object FullName, Name, Extension, Length, LastWriteTime | Export-Csv -Path 'C:\OneDriveReport.csv' -NoTypeInformation.

Generate Reports using Microsoft Graph API
For users who absolutely cannot sync the folder to their local machine, querying Microsoft's Graph API provides direct access to cloud file metadata.
Check Basic File Count via OneDrive Web
If you only need a quick summary of how many files exist in the folder without a detailed spreadsheet, use the web interface.
Manage Your Documents Seamlessly with WPS Office
While resolving complex OneDrive synchronization and PowerShell reporting issues, simplify your actual document workflow with WPS Office. It is a highly compatible, lightweight, and free office suite that integrates beautifully with cloud storage solutions, ensuring your files are always accessible and easy to manage.
- 1. Download and Install: Visit the official WPS Office website to download the free installer and follow the on-screen instructions.
- 2. Connect Cloud Storage: Open WPS Office, navigate to the 'Open' menu, and select 'Add Cloud Storage' to link your preferred cloud accounts.
- 3. Edit Files Directly: Access your cloud documents directly from the WPS dashboard, completely bypassing the need for local folder synchronization.

Frequently Asked Questions
Why can't PowerShell see my online-only OneDrive files?
If a folder is completely unsynchronized (meaning it is unchecked in OneDrive's 'Choose folders' settings), it does not exist on your local file system as an object. Command-line tools like PowerShell can only interact with files or placeholder files that are actively indexed by Windows File Explorer.
How do I identify which files failed to upload to OneDrive?
Upload failures are tracked by the local sync client, not the web interface. Click the OneDrive cloud icon in your Windows taskbar to open the Activity Center. Any files that failed to upload will be listed at the top with a red 'X' error icon and a brief explanation of the sync issue.
Is it possible to export a file list directly from the OneDrive web interface?
Personal OneDrive accounts do not feature a native 'Export to Excel' button for standard folders on the web. If you are using OneDrive for Business (SharePoint-backed), you can switch to the classic library experience to export to Excel. Otherwise, you must sync the folder using Files On-Demand and use local command-line tools.




