Tôi mới dùng PowerShell và đang gặp sự cố khi cố gắng loại trừ một số thư mục nhất định trong quá trình sao chép đệ quy. Bất kỳ trợ giúp được đánh giá cao! Cảm ơn trước.powershell - không thể loại trừ các thư mục trong bản sao đệ quy
$Date = Get-Date
$Date = $Date.adddays(-1)
$destPath = "\\destination\test"
$srcPath = "H:\program files\symphony\Save"
$srcPathRemits = “H:\program files\symphony\files"
$destDrive = "X:"
$User = "user"
$Password = "password"
$exclude = @('H:\program files\symphony\files\Temp\*','H:\program files\symphony\files\Other\*','H:\program files\symphony\files\etc\*','H:\program files\symphony\files\ParsedXML\*')
$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive($destDrive, $destPath, $false, $User, $Password)
gci -recurse -path $srcPathRemits -Exclude $exclude | ? {!($_.psiscontainer) -AND $_.lastwritetime -gt $Date} | % { write-host $_.fullname; Copy-Item -path $_.fullname -destination $destDrive}
$net.RemoveNetworkDrive($destDrive,"true","true")
Khi bạn nói rằng bạn gặp sự cố, bạn có thể cụ thể hơn không? Bạn có nhận được thông báo lỗi không? Nó là cái gì vậy? – David
Vui lòng đánh dấu câu hỏi được trả lời khi bạn có cơ hội. Cảm ơn. – David