Solved

Robocopy Log File

Posted on 2012-03-20
13
885 Views
Last Modified: 2012-03-28
Is there a way to log ONLY the files that are copied from source to destination; that is new files only.
0
Comment
Question by:Lionel MM
[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
13 Comments
 
LVL 10

Accepted Solution

by:
ReneGe earned 250 total points
ID: 37745656
Robocopy "%FolderSource%" "%FolderDestin%" *.* /E /NP /XO /copyall /XF "desktop.ini" "Thumbs.db" ".~*.*" "*.*#" "~*.*" "*.swp" "*.dmp" "*.tmp" "pagefile.sys" "hiberfil.sys" /XD "TEMP" >>LogFile.txt

Robocopy "%FolderSource%" "%FolderDestin%" *.* /E /NP /XO /copyall /XF "desktop.ini" "Thumbs.db" ".~*.*" "*.*#" "~*.*" "*.swp" "*.dmp" "*.tmp" "pagefile.sys" "hiberfil.sys" /XD "TEMP"  | FINDSTR -i "new file" >>LogFile.txt

Also, to see the loging options, type:
robocopy /? | findstr -i log
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37746430
No need to use Robocopy....

Use XCOPY which is part of DOS...

    XCOPY "%source%" "%destination%" /c /d /y

This will copy newer files from the source folder to the destination folder. If you want to copy files in subfolders too then you need to add '/e' to the command.
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 37746616
one small additon:

XCOPY "%source%" "%destination%" /c /d /y >copiedfiles.txt
0
Technology Partners: 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!

 
LVL 25

Author Comment

by:Lionel MM
ID: 37746634
problem with xcopy is that it will fail when you copy files with long directory structures so that is not an option--thanks anyway. used to be all I used until it started to fail.
0
 
LVL 25

Author Comment

by:Lionel MM
ID: 37746653
ReneGe
thanks for the suggestions but unfortunately I knew all that before but thanks. What I was asking is if one of the log options was to log only the new files. I have been unable to find that myself so I was hoping someone would know a hidden or know switch to the logging options. As you noted I could add a line to my batch file that can go through a log file and extract based on "new file" but I was hoping for a one-step process, a logging option part of robocopy.
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37746958
Oops! I did forget to redirect the output.... which is why I posted in the first place however, because I tested XCOPYs command options, I lost sight of the main objective - silly, but it happens to the  best of us! lol

Thank you for pointing that out.

    XCOPY "%source%" "%destination%" /c /d /y >>"%outputfile%"

Notice I included '>>' instead of just '>' to APPEND the output rather than replace it, but you can use either.
0
 
LVL 55

Expert Comment

by:Bill Prew
ID: 37750545
If you want to copy all files but just log the new ones, then I think Rene's approach is all you have.  No hidden options in ROBOCOPY to do it by itself.

~bp
0
 
LVL 25

Author Closing Comment

by:Lionel MM
ID: 37771115
No Solution but thanks for the effort and time.
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37771199
??? No solution ???

How about:

    XCOPY "%source%" "%destination%" /c /d /y >>logfile.txt

Example:

    XCOPY "c:\folder1\*.*" "c:\folder2\" /c /d /y >>logfile.txt

Will copy all newer files from c:\folder1\ to c:\folder2\ and add a list of copied files to logfile.txt.
0
 
LVL 25

Author Comment

by:Lionel MM
ID: 37771456
When you first responded I did not say anything because I felt there was no need to, in the hope that someone else would come up with a solution however your response now requires that I respond more directly. Did you read my Question? What does the Title of my question say? As a reminder here it is again "Robocopy Log File". To give me an xcopy solution -- you even say No need to use Robocopy.... Use XCOPY which is part of DOS...ignores my question and basically says "don't use what you are--use what I tell you to." I was not asking for an xcopy solution, and I told you (see above) "problem with xcopy is that it will fail when you copy files with long directory structures so that is not an option" Still, after all that, you still want to argue. You give a solution which is not about the app I am asked about and then you argue with me? Surely the asker, that's me, should be able to decide what the answer to the question is. Come on man. I could have simply deleted this question because there is NO ANSWER, but I still rewarded points to the one person who responded with a solution of some sort about my question which was about robocopy.
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37771886
Apologies.

You're quite right, I overlooked the fact you wanted a solution for ROBOCOPY.

I didn't know you had issues with long pathnames.

I must admit, I didn't read every reply.

Sorry there was no solution on this occasion.

Out of curiosity, does the following work for you?

    robocopy "source_path" "destination_path" *.* /LOG+:"logfile.txt"

Other options can be added to filter the logging of information. See:

    http://ss64.com/nt/robocopy.html
0
 
LVL 25

Author Comment

by:Lionel MM
ID: 37776177
The issue is a way to get a log file with only NEW files copied in it
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 37776289
How do you define 'NEW files'?

    - Files that don't already exist in the destination folder

    - Files that do already exist but are older than the source files

    - Or both of the above.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

724 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