道歉,因为我对PowerShell还是很陌生-我最近实现了RoboCopy,将大量.eml文件从一台服务器传输到另一台服务器。通常来说,这很好,但是每次跳过8-10个文件,并抛出以下错误。
2019/04/02 15:37:05错误2(0x00000002)更改文件属性 D:\ SMC_Drop \ test-test-test-test.eml系统找不到文件 指定。
但是文件在那里,所以我不太确定为什么会丢失它们,有什么想法吗?
robocopy $SMCDir $SMCPush $Files /NP /COPY:DT
$RoboError = $LASTEXITCODE
if ($RoboError -le 8 )
{
Write-Host " Robocopy Succeeded - Exit Code $RoboError"
$RoboError = 0
}
else
{
Write-Host " Robocopy failed with errorcode $RoboError"
}
Write-Host "
=====================================================================================
"
Write-Host " RoboCopy Completed - $Now"
Write-Host "
=====================================================================================
"
[Environment]::Exit($RoboError)
输出
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 0 0 0 0 0
Files : 5002 4992 0 0 10 0
Bytes : 2.805 g 2.789 g 0 0 16.10 m 0
Times : 0:38:33 0:38:32 0:00:00 0:00:01
Speed : 1295461 Bytes/sec.
Speed : 74.126 MegaBytes/min.
Ended : Tuesday, April 2, 2019 3:56:21 PM
Robocopy failed with errorcode 9