OneDrive shows files that are not there, and hides ones that are
Files On Demand means a folder can report 40 GB and occupy nothing, or the reverse. How to tell which is which and get the space back.
OneDrive is built into Windows and its Files On Demand feature means the size Explorer shows you for a folder may have almost nothing to do with what is on the drive. This cuts both ways and both are confusing.
The three states
| Icon | State | On the disk |
|---|---|---|
| Blue cloud | Online only | Nothing but a placeholder |
| Green tick, white fill | Locally available | The whole file, until space runs short |
| Green tick, solid fill | Always keep on this device | The whole file, permanently |
A file you opened once is locally available from then on, which is how a OneDrive folder quietly becomes the largest thing in your profile without you choosing that.
Seeing which is which
Get-ChildItem "$env:USERPROFILE\OneDrive" -Recurse -File -Force -ErrorAction SilentlyContinue |
Group-Object { if ($_.Attributes -band [IO.FileAttributes]::Offline) { 'cloud only' } else { 'on this device' } } |
Select-Object Name, Count, @{n='GB';e={[math]::Round(($_.Group | Measure-Object Length -Sum).Sum/1GB,2)}}The offline attribute is what marks a placeholder. That command splits your OneDrive folder into the two groups and totals each, which is the number Explorer will not give you.
Getting the space back
- Right click a folder in Explorer.
- Choose Free up space. The files stay visible with a cloud icon and download when opened.
- For a folder you never want local, leave Always keep on this device unticked.
- For everything, Settings, Sync and backup, Advanced settings has a global option.
This is removal of the local copy rather than deletion. Deleting a file inside OneDrive deletes it from the cloud and from every device, and those two actions sit next to each other in the same menu.
The trap on a full drive
If the drive fills, Windows and OneDrive can start making files online only automatically, which looks like files disappearing. They have not: they are placeholders and come back on demand. It is worth knowing before assuming something went wrong.
Other sync clients
Dropbox, Google Drive and iCloud all have the same feature under different names, and a machine with two of them is storing two sets of local copies. The Mac side of the same problem, with the settings for each service, is in what sync folders keep locally.
Common questions
Does OneDrive use space on my hard drive?
Only for files that are locally available. Online only files are placeholders that occupy almost nothing, and a file becomes local as soon as you open it, which is how the folder grows without being chosen.
How do I free up space used by OneDrive?
Right click the folder in Explorer and choose Free up space. The files stay visible with a cloud icon and download again when opened. It removes the local copy, not the file.
Why did my OneDrive files turn into cloud icons?
Windows and OneDrive can make files online only automatically when the drive is filling up. The files are not gone: they are placeholders and come back when opened.
What is the difference between Free up space and Delete?
Free up space removes the local copy and keeps the file in OneDrive. Delete removes it from OneDrive and every device signed in to it. Both are in the same right click menu.