首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >备份.thumbnails powershell

备份.thumbnails powershell
EN

Stack Overflow用户
提问于 2013-04-10 22:36:22
回答 2查看 105关注 0票数 0

我已经写了一个备份脚本,用来备份和记录错误。运行良好,除了一些.thumbnails,许多其他.thumbnails都会被复制!

在复制的54000个文件中,不会复制或记录相同的480个.thumbnails。我将检查属性,但我觉得复制项目功能应该可以完成这项工作。任何其他建议也是受欢迎的,但请继续关注主题,谢谢!这是我的backUP脚本

代码语言:javascript
复制
    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()
         }
       }
     }
EN

回答 2

Stack Overflow用户

发布于 2013-04-14 22:58:22

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

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

票数 0
EN

Stack Overflow用户

发布于 2013-04-20 01:00:11

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

这个设置,脚本运行得很好!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15928866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档