所以我试图使用icacls只让用户在具有特定关键字的文件夹中添加和访问文档。
然而,我无法得到我想要的东西。有人有任何提示吗?我不熟悉 Windows 的权限。谢谢!
这是我到目前为止提出的代码:
(我正在修改权限的帐户称为test)
echo >pdfFolderList.txt
:: Remove any permissions
icacls %~dp0* /remove test /T
:: Deny all access to everything
icacls %~dp0* /deny test:f /T
:: grant read access to everything
icacls %~dp0* /grant test:r /T
:: grant write access to folders with keywords
FOR /d /r %%a in ("*PDF Current Docs*", "*Shipping", "*QA Docs", "*Photos", "*Misc") DO (
echo %%a>>pdfFolderList.txt
icacls "%%a" /grant:r test:f /T
)
一个示例文件结构是:
├───Server_Files_Example_Folder
│ ├───A_JOB_NUMBER - Native Current Docs
│ ├───A_JOB_NUMBER - PDF Current Docs
│ │ ├───Drawings
│ ├───A_JOB_NUMBER - TEI Quotes Customer POs and Change Orders
│ ├───Correspondence
│ │ ├───From Customer
│ │ └───To Customer
│ ├───Docs From Customer
│ │ ├───Approval Drawings
│ ├───Misc
│ ├───Photos
│ ├───Programs etc
│ │ ├───As Shipped
│ │ └───Field Changes
│ ├───QA Docs
│ │ └───Markups
│ ├───Service
│ │ ├───Correspondence
│ │ └───Reports
│ ├───Shipping
│ │ └───test
│ └───Vendor Docs
│ ├───Order Confirmation
│ ├───POs
│ └───Vendor Quotes