?
Solved

Batch File: Robocopy

Posted on 2010-08-27
7
Medium Priority
?
840 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 59

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 59

Assisted Solution

by:Bill Prew
Bill Prew earned 1000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 1000 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 59

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

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.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Screencast - Getting to Know the Pipeline

840 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