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
Solved

Robocopy Log File

Posted on 2012-03-20
13
872 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
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 80

Expert Comment

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

XCOPY "%source%" "%destination%" /c /d /y >copiedfiles.txt
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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 53

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
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…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

861 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