Solved

Batch File: Robocopy

Posted on 2010-08-27
7
784 Views
Last Modified: 2012-05-10
Hi there,

I have this Robocopy command line that needs to be "fixed".

Robocopy "!BasePath_Source!" "!BasePath_Dest!" * /TEE /ETA /E /COPYALL /MIR /NP /ZB /LOG+:"%File_LOG_Mirror%_temp.TXT" /XF Thumbs.db ~*.* *.swp *.dmp *.tmp pagefile.sys hiberfil.sys /XD MCAF*.TMP "$VAULT$.AVG" "_RESTORE" "MSOCache" "Recycled" "RECYCLER" "Temporary Internet Files" "System Volume Information" "Virtual Machines *" "temp" ISO

PROBLEM:
-------------------------------------------------------------
The LOG file stores all the files = NO GOOD

I need that the LOG file only logs the new, or changed files = GOOD

Thanks for your help,
Rene


0
Comment
Question by:ReneGe
  • 3
  • 3
7 Comments
 
LVL 52

Expert Comment

by:Bill Prew
ID: 33546874
Do you mean you want the copy itself to only copy the new or changed files, or that you still want it to copy all files, but only log the new and changed files?

~bp
0
 
LVL 10

Author Comment

by:ReneGe
ID: 33546914
Hey bp!

The mirror part does it good.

My focus here is the log file.

I only want to log the copied or changed files.

Thanks,
Rene
0
 
LVL 52

Assisted Solution

by:Bill Prew
Bill Prew earned 250 total points
ID: 33546973
Hmm, a little confused.  When I ran a test with the /MIR option, it only listed the file names of the files it copied, see attached.  What am I missing?

~bp
[c:\temp]robocopy c:\temp\xxcopy c:\temp2\xxcopy /mir
 
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------
 
  Started : Fri Aug 27 18:14:23 2010
 
   Source : c:\temp\xxcopy\
     Dest : c:\temp2\xxcopy\
 
    Files : *.*
 
  Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
 
------------------------------------------------------------------------------
 
          New Dir          6    c:\temp\xxcopy\
100%        New File                2026        UIXXCOPY.BAT
100%        New File              146936        XXCONSOLE.EXE
100%        New File              911751        XXCOPY.CHM
100%        New File              499248        XXCOPY.EXE
100%        New File              499248        XXCOPYSU.EXE
100%        New File               69632        XXPBAR.EXE
 
------------------------------------------------------------------------------
 
               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         1         0         0         0         0
   Files :         6         6         0         0         0         0
   Bytes :    2.03 m    2.03 m         0         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
 
 
   Speed :             3235320 Bytes/sec.
   Speed :             185.126 MegaBytes/min.
 
   Ended : Fri Aug 27 18:14:24 2010
 
[c:\temp]robocopy c:\temp\xxcopy c:\temp2\xxcopy /mir
 
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------
 
  Started : Fri Aug 27 18:14:33 2010
 
   Source : c:\temp\xxcopy\
     Dest : c:\temp2\xxcopy\
 
    Files : *.*
 
  Options : *.* /S /E /COPY:DAT /PURGE /MIR /R:1000000 /W:30
 
------------------------------------------------------------------------------
 
                           6    c:\temp\xxcopy\
 
------------------------------------------------------------------------------
 
               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :         6         0         6         0         0         0
   Bytes :    2.03 m         0    2.03 m         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
 
   Ended : Fri Aug 27 18:14:33 2010

Open in new window

0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 10

Author Comment

by:ReneGe
ID: 33547054
Me, it also lists all bunch of non changed folders.
0
 
LVL 2

Accepted Solution

by:
plymelk earned 250 total points
ID: 33547120
Add the following options to your command.
     /NDL    Exclude directory names (listing)
     /XO     Exclude Old files
     /XX      Exclude Extra files (files in the destination, but not in the original source)
You may want to use this option, but most likely not.
     /XL     Exclude Lonely (Unique files are not copied)
New command:
Robocopy "!BasePath_Source!" "!BasePath_Dest!" * /NDL /XX /XO /TEE /ETA /E /COPYALL /MIR /NP /ZB /LOG+:"%File_LOG_Mirror%_temp.TXT" /XF Thumbs.db ~*.* *.swp *.dmp *.tmp pagefile.sys hiberfil.sys /XD MCAF*.TMP "$VAULT$.AVG" "_RESTORE" "MSOCache" "Recycled" "RECYCLER" "Temporary Internet Files" "System Volume Information" "Virtual Machines *" "temp" ISO
0
 
LVL 52

Expert Comment

by:Bill Prew
ID: 33547145
Yes, I think /NDL is what you are after.

~bp
0
 
LVL 10

Author Comment

by:ReneGe
ID: 33547184
/NDL was indeed the solution.

Thanks guys!!!

Cheers,
Rene
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now