Solved

Robocopy Log File

Posted on 2012-03-20
13
865 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:lionelmm
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 78

Expert Comment

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

XCOPY "%source%" "%destination%" /c /d /y >copiedfiles.txt
0
 
LVL 24

Author Comment

by:lionelmm
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 24

Author Comment

by:lionelmm
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 52

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 24

Author Closing Comment

by:lionelmm
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 24

Author Comment

by:lionelmm
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 24

Author Comment

by:lionelmm
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
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). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

911 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

23 Experts available now in Live!

Get 1:1 Help Now