none
Robocopy: doesn't write to log file or stops during execution RRS feed

  • Question

  • In the windows task scheduler I have created job which call powershell script.

    $fromPath =  "D:"
    $toPath = "D:\Tmp2"
    
    $dateString = (Get-Date).ToString("s").Replace(":","-")
    $logPath = $fromPath + "\PSScripts\Logs\MoveTest_" + $dateString + ".txt"
    $xd1 = $fromPath + "\Tmp\XXX\X1"
    $xd2 = $fromPath + "\Tmp\XXX\X2"
    
    Add-Content $logPath (Get-Date).ToString("s").Replace(":","-")
    
    robocopy $fromPath"\Tmp\XXX" $toPath"\XXX" "test.txt" /move /minage:20170627 /z /b /s /LEV:2 /mt:50 /r:3 /w:10 /log+:$logPath /xd $xd1 $xd2
    
    Add-Content $logPath (Get-Date).ToString("s").Replace(":","-")

    There are two strange cases:

    1. in one server I run job and see log file and size increases but after some time file has stopped to be filled.

    Log file:

    2017-06-27T21-02-08
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows                              
    -------------------------------------------------------------------------------
    
      Started : Tue Jun 27 21:02:18 2017
    
       Source : D:\Tmp\XXX\
         Dest : D:\Tmp2\XXX\
    
        Files : test.txt
    
     Exc Dirs : D:\Tmp\XXX\X1
            D:\Tmp\XXX\X2
    
      Options : /S /COPY:DAT /MOVE /B /MINAGE:20170627 /LEV:2 /MT:50 /R:3 /W:10 
    
    ------------------------------------------------------------------------------
    
    *EXTRA Dir        -1    D:\Tmp2\XXX\1003090\
    *EXTRA Dir        -1    D:\Tmp2\XXX\1003105\
    *EXTRA Dir        -1    D:\Tmp2\XXX\1004605\
    1. in second server I run job and see log file but file size doesn't increase. I see only header

    Log file:

    2017-06-27T21-02-08
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows                              
    -------------------------------------------------------------------------------
    
      Started : Tue Jun 27 21:02:18 2017
    
       Source : D:\Tmp\XXX\
         Dest : D:\Tmp2\XXX\
    
        Files : test.txt
    
     Exc Dirs : D:\Tmp\XXX\X1
            D:\Tmp\XXX\X2
    
      Options : /S /COPY:DAT /MOVE /B /MINAGE:20170627 /LEV:2 /MT:50 /R:3 /W:10 
    
    ------------------------------------------------------------------------------





    alert





    • Edited by olegmkr Wednesday, June 28, 2017 4:00 AM
    • Moved by Bill_Stewart Wednesday, July 26, 2017 7:53 PM This is not "teach me how to use robocopy" forum
    Tuesday, June 27, 2017 7:33 PM

All replies

  • The code and logs do not match.

    The source/dest are not written correctly:

    robocopy "$fromPath\Tmp\XXX" "$toPath\HTML" "test.txt" /move /minage:20170627 /z /b /s /LEV:2 /mt:50 /r:3 /w:10 /log+:$logPath  /xd $xd1 $xd2

    Very deep folders may take a long time.

    Since this is not a RoboCopy forum you should post in a Windows forum for the OS type affected.


    \_(ツ)_/

    Tuesday, June 27, 2017 9:21 PM
  • "source/dest are not written correctly" - this is copy/paste problem when I had written this question.

    alert

    Wednesday, June 28, 2017 4:01 AM
  • In the windows task scheduler I have created job which call powershell script.

    $fromPath =  "D:"
    $toPath = "D:\Tmp2"
    
    $dateString = (Get-Date).ToString("s").Replace(":","-")
    $logPath = $fromPath + "\PSScripts\Logs\MoveTest_" + $dateString + ".txt"
    $xd1 = $fromPath + "\Tmp\XXX\X1"
    $xd2 = $fromPath + "\Tmp\XXX\X2"
    
    Add-Content $logPath (Get-Date).ToString("s").Replace(":","-")
    
    robocopy $fromPath"\Tmp\XXX" $toPath"\XXX" "test.txt" /move /minage:20170627 /z /b /s /LEV:2 /mt:50 /r:3 /w:10 /log+:$logPath /xd $xd1 $xd2
    
    Add-Content $logPath (Get-Date).ToString("s").Replace(":","-")

    There are two strange cases:

    1. in one server I run job and see log file and size increases but after some time file has stopped to be filled.

    Log file:

    2017-06-27T21-02-08
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows                              
    -------------------------------------------------------------------------------
    
      Started : Tue Jun 27 21:02:18 2017
    
       Source : D:\Tmp\XXX\
         Dest : D:\Tmp2\XXX\
    
        Files : test.txt
    
     Exc Dirs : D:\Tmp\XXX\X1
            D:\Tmp\XXX\X2
    
      Options : /S /COPY:DAT /MOVE /B /MINAGE:20170627 /LEV:2 /MT:50 /R:3 /W:10 
    
    ------------------------------------------------------------------------------
    
    *EXTRA Dir        -1    D:\Tmp2\XXX\1003090\
    *EXTRA Dir        -1    D:\Tmp2\XXX\1003105\
    *EXTRA Dir        -1    D:\Tmp2\XXX\1004605\
    1. in second server I run job and see log file but file size doesn't increase. I see only header

    Log file:

    2017-06-27T21-02-08
    
    -------------------------------------------------------------------------------
       ROBOCOPY     ::     Robust File Copy for Windows                              
    -------------------------------------------------------------------------------
    
      Started : Tue Jun 27 21:02:18 2017
    
       Source : D:\Tmp\XXX\
         Dest : D:\Tmp2\XXX\
    
        Files : test.txt
    
     Exc Dirs : D:\Tmp\XXX\X1
            D:\Tmp\XXX\X2
    
      Options : /S /COPY:DAT /MOVE /B /MINAGE:20170627 /LEV:2 /MT:50 /R:3 /W:10 
    
    ------------------------------------------------------------------------------




    alert

    • Merged by jrv Wednesday, June 28, 2017 4:45 AM DUPLICATE
    Wednesday, June 28, 2017 4:10 AM
  • Please do not post duplicates.

    This request would be best handled in the Windows forum for your OS.


    \_(ツ)_/

    Wednesday, June 28, 2017 4:46 AM
  • How to move to Windows forum?

    alert

    Wednesday, June 28, 2017 5:20 AM
  • This would be a good place to start: https://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winservergen

    Do not ask about PowerShell.  Ask about your issue with RC.


    \_(ツ)_/

    Wednesday, June 28, 2017 5:29 AM