我写了一个备份脚本,它备份并记录错误。工作正常,除了一些 .thumbnails,许多其他 .thumbnails 确实被复制了!
54000 个文件复制,相同的 480 个 .thumbnails 永远不会被复制或记录。我将检查属性,但我觉得复制项功能应该完成这项工作。也欢迎任何其他建议,但请保持主题,谢谢!!!!这是我的备份脚本
Function backUP{ Param ([string]$destination1 ,$list1)
$destination2 = $destination1
#extract new made string for backuplog
$index = $destination2.LastIndexOf("\")
$count = $destination2.length - $index
$source1 = $destination2.Substring($index, $count)
$finalstr2 = $logdrive + $source1
Foreach($item in $list1){
Copy-Item -Container: $true -Recurse -Force -Path $item -Destination $destination1 -erroraction Continue
if(-not $?)
{
write-output "ERROR de copiado : " $error| format-list | out-file -Append "$finalstr2\GCI-ERRORS-backup.txt"
Foreach($erritem in $error){
write-output "Error Data:" $erritem.TargetObject | out-file -Append "$finalstr2\GCI-ERRORS-backup.txt"
}
$error.Clear()
}
}
}