Yesterday I experienced an interesting case. A bulk copy was to be done with permissions. But somehow we couldn't use Robocopy. First of all, please use Robocopy in situations like this. You can just paste this on cmd
Robocopy.exe <Source Path> <Destination Path> /COPY:DATS /E
That's all!!!
Now let's focus on "the die is cast" situation.
I had to write this simple copy-permissions function to copy JUST THE PERMISSIONS!
You can get the script from here, Github.
Now I think I can share how to use this simple thing!
On Powershell, type 2 mandatory fields which are string "sourcePath" and string "targetPath" and an optional switch "logEnabled"
.\Copy-Permissions.ps1 -SourcePath "<Source Path>" -TargetPath "<Target Path>"
OR
.\Copy-Permissions.ps1 -SourcePath "<Source Path>" -TargetPath "<Target Path>" -LogEnabled
Log Enabled prints out every single step otherwise, the script only writes failed test paths.
That's all. Have fun with newly gained 30 minutes :)
Comments
Post a Comment