xcopy - folder to folder

Posted on 2010-08-20
Last Modified: 2012-06-21
I am looking for a xcopy solution so I can copy C:\test to d:\test - .
First time it is running it copy everything, but afterwards it just has to take the changes since to first backup

Can anyone help ?
Question by:rossoneris

Accepted Solution

Amivit earned 125 total points
ID: 33484479
xcopy.exe C:\test\*.* D:\test\*.* /D
add /E uf you wan't to include subdirectories.
xcopy.exe C:\test\*.* D:\test\*.* /D /E

Hope this works for you!
LVL 28

Expert Comment

ID: 33484507
I am attaching the code I use.

All you need is schedule it and it will always copy from one folder to another
LVL 53

Expert Comment

by:Bill Prew
ID: 33490117
==> it just has to take the changes since to first backup

Can you elaborate on what that means?  I can see basically 4 possible situations, can you state what you want to happen in each case?

(1) a file is in both locations and has not changed

(2) a file is in both locations and has changed

(3) a file has been added and only exists in the c:\test folder

(4) a file has been deleted from c:\test, and only exists in d:\test now

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center


Expert Comment

ID: 33497888
By default, XCOPY will copy all files. Maybe you're unintentionally telling it to skip the existing files? The syntax I almost always use is XCOPY (sourcepath) (destpath) /C/H/E/R/Y . This continues to copy even if error occur, copies hidden, readonly, empty subdirectories and overwrites existing files without prompting.

Hope this helps!

Expert Comment

ID: 33512879
xcopy c:\test\*.* d:\test\ /M

/M only copies files with the archive attribute set and then sets it off

changing a file switches the attribute on again which qualifies it to be copied with /M


Expert Comment

ID: 33528926
Hi rossoneris, did this work for you?

Expert Comment

ID: 33552093
just add the /Y flag (so it would overwrite without prompt)

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 105
Rubik's Cube Code for Effective Presentation 3 63
ejb example issues 3 28
Delphi: barcode reading on android platform 1 51
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

828 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