0

我写了一个备份脚本,它备份并记录错误。工作正常,除了一些 .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()
         }
       }
     }
4

2 回答 2

0

您确定您的backUP功能正在接收.thumbnails文件$list1吗?如果文件被隐藏,那么只有在使用开关Get-ChildItem时才会返回它们。-Force

至于其他建议,Robocopy.exe是一个很好的执行文件同步的专用工具。

于 2013-04-14T14:58:21.693 回答
0

显然,我没有缩略图文件夹的权限。

那一套,脚本运行良好!

于 2013-04-19T17:00:11.237 回答