在 Mac 上查询和设置文件按需状态Query and set Files On-Demand states on Mac

使用 OneDrive 文件随需要,文件可以有三种状态之一。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 command:

  • /Applications/OneDrive.App/Contents/MacOS/OneDrive /getpin <Path to file or folder>/Applications/OneDrive.App/Contents/MacOS/OneDrive /getpin <Path to file or folder>

可编写脚本的命令Scriptable commands

使用以下命令设置文件和文件夹状态。Use the following commands to set file and folder states.

文件按需状态Files On-Demand state 文件属性状态File attribute state CommandCommand
始终可用Always available
固定Pinned
/Applications/OneDrive.App/Contents/MacOS/OneDrive /setpin <path>/Applications/OneDrive.App/Contents/MacOS/OneDrive /setpin <path>
本地可用Locally available
ClearpinClearpin
/Applications/OneDrive.App/Contents/MacOS/OneDrive /clearpin <path>/Applications/OneDrive.App/Contents/MacOS/OneDrive /clearpin <path>
仅联机Online-only
取消固定Unpinned
/Applications/OneDrive.App/Contents/MacOS/OneDrive /unpin <path>/Applications/OneDrive.App/Contents/MacOS/OneDrive /unpin <path>

备注

若要设置文件夹中所有项的文件属性状态,请添加 /r 参数。To set the file attribute state for all items within a folder, add the /r parameter.
固定仅联机文件可使同步应用下载文件内容,取消固定下载的文件不会本地存储文件内容,因此释放了设备上的空间。Pinning an online-only file makes the sync app 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."