【问题标题】:backing up .thumbnails powershell备份 .thumbnails powershell
【发布时间】:2013-04-10 14:36:22
【问题描述】:

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

【问题讨论】:

    标签: powershell copy backup thumbnails


    【解决方案1】:

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

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

    【讨论】:

    • 嘿皇帝,它正在接收 .thumbnails 导致其他 .thumbs 正在复制 ok,看起来我没有这个特定文件夹的权限,因为我已经检查过了。至于 robocopy,我会将它集成到这个脚本中,但我喜欢 powershell 中的错误功能
    【解决方案2】:

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

    那一套,脚本运行良好!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-21
      • 1970-01-01
      • 2013-08-15
      • 2017-08-16
      • 2021-04-13
      • 1970-01-01
      • 2020-07-09
      • 1970-01-01
      相关资源
      最近更新 更多