我已经写了一个备份脚本,用来备份和记录错误。运行良好,除了一些.thumbnails,许多其他.thumbnails都会被复制!
在复制的54000个文件中,不会复制或记录相同的480个.thumbnails。我将检查属性,但我觉得复制项目功能应该可以完成这项工作。任何其他建议也是受欢迎的,但请继续关注主题,谢谢!这是我的backUP脚本
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()
}
}
}发布于 2013-04-14 22:58:22
您确定backUP函数正在接收$list1格式的.thumbnails文件吗?如果文件是隐藏的,那么只有在使用-Force开关时,Get-ChildItem才会返回它们。
至于其他建议,Robocopy.exe是执行文件同步的一个很好的专用工具。
发布于 2013-04-20 01:00:11
显然,我没有权限访问缩略图文件夹。
这个设置,脚本运行得很好!
https://stackoverflow.com/questions/15928866
复制相似问题