Solved

Batch File: Robocopy

Posted on 2010-08-27
7
781 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 51

Expert Comment

by:Bill Prew
Comment Utility
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
Comment Utility
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 51

Assisted Solution

by:Bill Prew
Bill Prew earned 250 total points
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Author Comment

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

Accepted Solution

by:
plymelk earned 250 total points
Comment Utility
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 51

Expert Comment

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

~bp
0
 
LVL 10

Author Comment

by:ReneGe
Comment Utility
/NDL was indeed the solution.

Thanks guys!!!

Cheers,
Rene
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

743 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

14 Experts available now in Live!

Get 1:1 Help Now