简体   繁体   English

robocopy 使用 secfix 修复仅子目录的权限,不包括根目录

[英]robocopy using secfix to fix permissions of ONLY subdirectories, excluding root directory

I have a rather interesting issue that I think is logically possible via Robocopy, but I cannot find the correct syntax to accomplish this goal.我有一个相当有趣的问题,我认为通过 Robocopy 在逻辑上是可能的,但我找不到正确的语法来实现这个目标。

Problem :问题

I am trying to sync a lot of data via two remote shares.我正在尝试通过两个远程共享同步大量数据。 IE: robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64 IE: robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64

The issue arises due to the fact that the root directory has different permissions than all of the subdirectories.出现此问题的原因是根目录与所有子目录具有不同的权限。 I have close to 1000 subdirectories that makes this tedious and difficult to manually do.我有将近 1000 个子目录,这使得手动操作变得乏味且困难。

Current Issue目前的问题

Running 'robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' changes ONLY the permissions of the root directory, but not the subdirectories.运行 'robocopy "\share1\root" "\share2\root" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' 仅更改根目录的权限,但不更改根目录的权限子目录。

Running 'robocopy "\share1\root\subdirectory1" "\share2\root\subdirectory1" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' DOES result in the desired state, but is far too tedious to do for over 1000 sub directories运行 'robocopy "\share1\root\subdirectory1" "\share2\root\subdirectory1" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64' 确实会产生所需的 state,但是对于超过 1000 个子目录来说太繁琐了

Desired Results期望的结果

Either a robocopy command that would ONLY change the permissions on the subdirectories (and the child elements within those directories) but maintain the perms on the root directory, or another means of accomplishing the above.要么是一个 robocopy 命令,它只会更改子目录(以及这些目录中的子元素)的权限,但会保留根目录上的权限,或者是另一种实现上述目的的方法。

Any help would be appreciated!任何帮助,将不胜感激!

I guess you can technically use PowerShell to automate looping through your directory tree.我猜你可以在技术上使用 PowerShell 来自动循环遍历你的目录树。

Get-ChildItem -Path '\share1\root' -Directory | Foreach-Object {
    robocopy "\share1\root\$($_.Name)" "\share2\root\$($_.Name)" /MIR /SECFIX /SEC /S /E /R:5 /W:2 /MT:64
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase:此文件不存在且没有索引。在当前目录中找到html或在根目录中找到404.html - Firebase: This file does not exist and there was no index.html found in the current directory or 404.html in the root directory 使用 AWS SAM 和 DynamoDB 限制 Lambda 权限 - Limiting Lambda Permissions using AWS SAM and DynamoDB 值事件侦听器返回根节点唯一子节点的数据 - Value Event Listener returning data of only child of Root Node 使用 CLI 使 S3 存储桶权限对“所有人”公开访问 - Make an S3 Bucket Permissions Public Access to 'Everyone' using CLI 存储桶权限 - Bucket permissions 使用 scp 在 EC2 实例之间传输文件会导致“错误的所有者或权限” - File transfer between EC2 instances using scp results in "Bad owner or permissions" 如何使用 docker-compose 修复 dynamodb 本地调用 - How to fix dynamodb local call using docker-compose Firestore:使用具有复杂安全规则的快照侦听器时“权限缺失或权限不足” - Firestore: 'Missing or insufficient permissions' when using snapshot listener with complex security rules 将 QuickSight 指向其中包含多个子目录的 s3 Bucket - Point QuickSight to s3 Bucket with sevral subdirectories in it 服务帐号权限 - Service accounts permissions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM