Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从 Python 脚本在 Windows 上的 Samba 共享中创建目录和文件。我可以(也确实)使用 Python 中的 .NET 3.5。我想创建具有某些所有者和权限的这些目录和文件。我能以某种方式实现这一目标吗?
您可以使用 CACLS.exe 显示或修改文件和文件夹的访问控制列表 (ACL)。你可以从 Python 调用它,例如:
result = os.popen("cacls " + '"' + theDirPath + '"')
有一个很好的 Python 脚本示例,它在此处设置权限