none
Using Robocopy

    Question

  • I am trying to use robocopy in a batch file to move log files that are older than 5 days into a subdirectory of the current directory.  Also I want it to report only how many files were copied just like copy and xcopy do.

    Here's what I have now:

    robocopy . ./OldLogFiles *.log /MOV /MINAGE:5 /NS /NC /NDL /NJH /NJS

    When I run it, it looks like it recopies the files in the /OldLogFiles folder too.  It list all the filenames and the filepath.

    I am trying to run this also on Windows Server 2008 R2 Standard (if that makes a difference).

    Thanks for any help,


    Fred

    Thursday, March 23, 2017 6:38 PM

Answers

  • Hi, 

    Under my testing, please use /lev:0, so that we can only copy the log file under  /OldLogFiles folder in the top directory. 


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, March 24, 2017 6:36 AM
    Moderator

All replies

  • Have you tried to add the option /LEV:1

    /LEV:n :: only copy the top n LEVels of the source directory tree

    hth


    This posting is provided AS IS without warranty of any kind

    Friday, March 24, 2017 12:41 AM
  • Hi, 

    Under my testing, please use /lev:0, so that we can only copy the log file under  /OldLogFiles folder in the top directory. 


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, March 24, 2017 6:36 AM
    Moderator