Powershell - Copy the folder with Permission (ACL)
The below script will copy the folder with ACL. Beauty is it will create the folder in the destination path if already not there, where as we can't do this from ROBOCOPY.
$finalreport = @()
$servers = Get-Content -Path "C:\Delete\directories.txt"
Foreach ($server in $servers)
{
ROBOCOPY "$server" "D:\TEST\$server" /MIR /SEC /pf /R:3 /v /LOG:C:\Delete\nameoflogfile123.txt
}
$finalreport = @()
$servers = Get-Content -Path "C:\Delete\directories.txt"
Foreach ($server in $servers)
{
ROBOCOPY "$server" "D:\TEST\$server" /MIR /SEC /pf /R:3 /v /LOG:C:\Delete\nameoflogfile123.txt
}
Comments
Post a Comment