#209405 - 2014-08-11 09:03 PM
Re: move not work over unc paths?
[Re: Lonkero]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
|
Yeah - that would be the RoboCopy Voodoo. If I hadn't been involved in a datacenter migration this weekend, I might have seen that and sent you my code..
; define the RoboCopy command parameters and arguments - copy all subfolders including empty subfolders from $Src to \\$Target\$Dst
; $Exclude contains exclude statement (if any); $RCArgs contains extra RoboCopy args (if any)
; 2 retries on failure, 5 second delay on retry, $RCLogFile contains filespec for log file
$Cmd = '%COMSPEC% /c ' + $BIN + 'robocopy ' + $Src + ' \\' + $Target + '\' + $Dst + $Exclude + $RCArgs + ' /E /R:2 /W:5 /LOG+:' + $RCLogFile
fMsg(' Copying from ' + $Src + ' to ' + $Dst, '', 1, 16) ; Log the copy operation
If Not $DEBUG
Shell $Cmd
If @ERROR > 7 ; error copying files if 8 or higher
$Err = 1 ; set global error flag
$fErr = $fErr + 4 ; set RoboCopy error bit
$SErr = ' Error: ' ; Handle robocopy error/exit codes (V1.3)
Else
$SErr = ' Success: '
EndIf
$SErr = $SErr + @ERROR + ' - '
If @ERROR & 16
$SErr = $SErr + 'Fatal error, no files copied. '
EndIf
If @ERROR & 8
$SErr = $SErr + 'Copy errors, retry exceeded. '
EndIf
If @ERROR & 4
$SErr = $SErr + 'Mismatched files/folders detected, '
EndIf
If @ERROR & 2
$SErr = $SErr + 'Extra files/folders detected, '
EndIf
If @ERROR & 1
$SErr = $SErr + '1+ Files copied, '
EndIf
If @ERROR = 0
$SErr = 'Warning! No files copied. '
EndIf
EndIf
fMsg(': ' + $SErr, '', 0, 17) ; append result to log
fMsg(' Cmd: ' + $Cmd, '', 0, $DbgLog) ; show command if debug mode
Next ; next path Exit of 1 is good, not bad, and exit of 0 might be bad (nothing copied) not good. 
Glenn
_________________________
Actually I am a Rocket Scientist!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 883 anonymous users online.
|
|
|