3/17/2015 update:

v1.1 - Added functionality to gather file and folder copy summaries and export to CSV


 

This script will parse one or more Robocopy log files, and return a list of files that failed to copy and the corresponding error code.

To see inline help, type in:

PowerShell
Edit|Remove
help Get-FailedFiles -ShowWindow
Powershell displays help information similar to:
 .SYNOPSIS
  Script to parse Robocopy log file(s) and return files that failed to copy.

 .DESCRIPTION
  This script will parse Robocopy log file(s) and return a PS object that has 2 properties: FilePath and ErrorCode fro each file that failed to copy.

 .PARAMETER RoboLog
  Path to Robocopy log file

 .EXAMPLE
  Get-FailedFiles -RoboLog .\logs\Robo-Migrate-FileShares_NYFILSRV01P-2015-03-11_05-27-26AM.txt
  The script will return list of files that failed to copy and the corresponding error codes (in decimal)

 .EXAMPLE
  $FailedFiles = Get-FailedFiles (Get-ChildItem -Path .\logs | where { $_.Name.StartsWith('Robo') }).FullName
  This command will parse all the files under .\logs subfolder that start with 'Robo' and return the files that
  failed to copy and their error codes. This can be presented:
  $FailedFiles | FT -Auto                             # in tabular format
  $FailedFiles | Out-Gridview                         # in Powershell ISE Gridview
  $FailedFiles | Export-Csv .\FailedFiles.CSV -NoType # or exported to CSV

 .OUTPUTS 
  This function returns a PS object that has 2 properties: FilePath and ErrorCode.

 .LINK
  https://superwidgets.wordpress.com/category/powershell/

 .NOTES
  Function by Sam Boutros
  v1.0 - 03/11/2015

For more information see https://superwidgets.wordpress.com/category/powershell/