[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

Need to have batch file create a report after executing xcopy

I have a batch file that updates destination folders using xcopy.  I need to insert a command that will generate a text file report with any files that it had to copy to the destinations.  I am working with multiple destinations within the batch.
  • 2
2 Solutions
read the following


To update files in the \Reports directory with the files in the \Rawdata directory that have changed since December 29, 1993, type:

xcopy \rawdata \reports /d:12-29-1993

To update all the files that exist in \Reports in the previous example, regardless of date, type:

xcopy \rawdata \reports /u

To obtain a list of the files to be copied by the previous command (that is, without actually copying the files), type:

xcopy \rawdata \reports /d:12-29-1993 /l > xcopy.out

The file Xcopy.out lists every file that is to be copied.

Then, at the end of the above add:

copy xcopy.out lpt1:
yeah, the code provided just gives a report of files TO BE COPIED, it doesn't copy files.

glenns code does the real copy.
murrycAuthor Commented:
What I actually needed was just the command '>>reportfile.txt' after each xcopy command.  This creates the file reportfile inside of the root folder where the batch file is executed and it displays all of the files that had to be copied.

Thanks for all the efforts.

Featured Post

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now