Query and set Files On-Demand states

With OneDrive Files On-Demand, files can be in one of three states. Each of these states corresponds to a file attribute state. To query the current state of a file or folder, use the following commands:

  • Windows: attrib
  • Mac: /Applications/OneDrive.App/Contents/MacOS/OneDrive /getpin

Scriptable commands

Use the following commands to set file and folder states.

Files On-Demand state File attribute state Windows command Mac command
Always available
attrib +p <path>
/Applications/OneDrive.App/Contents/MacOS/OneDrive /setpin <path>
Locally available
attrib -p <path>
/Applications/OneDrive.App/Contents/MacOS/OneDrive /clearpin <path>
attrib +u <path>
/Applications/OneDrive.App/Contents/MacOS/OneDrive /unpin <path>


To set the file attribute state for all items within a folder on Mac, add the /r parameter.
Pinning an online-only file makes the sync client download the file contents, and unpinning a downloaded file frees up space on the device by not storing the file contents locally.
To set an online-only file or folder to "locally available," you must first set it to "always available."