标签:
New-Item -path $file_path -itemtype file
New-Item -path $dir_path -type directory
删除目录
Remove-Item-Force-Recurse $dir
$account ="Business"
$Folder = D:\WebSite
$FileSystemRights ="FullControl"
$objType =[System.Security.AccessControl.AccessControlType]::Allow
$accessRule =New-ObjectSystem.Security.AccessControl.FileSystemAccessRule($account,$FileSystemRights,$objType)
$acl =Get-Acl $Folder
$acl.SetAccessRule($accessRule)
Set-Acl-Path $Folder -AclObject $acl
$user ="admin"
$passwd ="123456"
net use $dir $passwd /user:$user
$files =Get-ChildItem-Path $RemotePath -Force
foreach($file in $files){
Copy-Item-Path $file.FullName-Destination $LocalPath -Recurse-Force
}
标签:
原文地址:http://www.cnblogs.com/letong/p/4744348.html