Solved

Batch File: Robocopy

Posted on 2010-08-27
7
797 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 54

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 54

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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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 54

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

749 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