Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to deploy a website from my desktop to my webserver and so right now I am doing this:

 xcopy C:\source X:\destination /s

My desktop is a Windows XP machine and I need to copy to a Windows Server 2008 machine, but this copies everything and the whole site is very large and it takes a really long time to finish copying.

Is there anyway to specific just copy new or updated files? I see you can pass in a changed since date but I wanted to see if there is a simpler way to compare against destination file...

Also, I am open to using anything outside of xcopy that can do the job as well...

share|improve this question

migrated from Jul 8 '11 at 20:48

This question came from our site for professional and enthusiast programmers.

You can also try Robocopy. – joerage Jul 9 '11 at 1:11
up vote 56 down vote accepted

From the XCOPY documentation:

/d[:mm-dd-yyyy] : Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.

So, with your example, it should read:

xcopy C:\source X:\destination /s /d
share|improve this answer
the "/d" seems like you have to give it a date. as mentioned in the question, I don't have a cutoff date in mind. i just want to copy over new and updated files – leora Jul 8 '11 at 18:32
No, the date is optional! Thats why it is in square brackets. Did you actually read that line? It says it does exactly what you want it to do! – Mark Jul 8 '11 at 18:36
The only thing to be careful about with this answer is that the web server and your workstation are set to the same time! If they aren't both using NTP this could either miss files or copy more files than necessary. – CarlF Jul 8 '11 at 20:52
While the documentation states it precisely, it's easy to overlook the /d because it's not that salient that the date is optional, then look at the other options and think there's no solution. :-) – Stéphane Gourichon Aug 31 '15 at 14:52
Lower case d was causing me problems.. this syntax worked for me; xcopy Directory1 directory2 /s /D:12-21-2014 – Hariboo Jan 14 at 23:22

Robocopy is a good alternative as well:

By default Robocopy will only copy a file if the source and destination have different time stamps or different file sizes.

Plus, you can do a lot more - the mirror command is handy for websites where you are deleting files as well.

share|improve this answer
Thanks for mentioning robocopy - its always nice to learn some of the new utilities available. – Casper Leon Nielsen Mar 22 '13 at 12:56

Use the /A option. All the new or modified files will have archive attribute set.

Check the below link for details:

share|improve this answer
Yes, but unless you xcopy /M, then the source files will still have the archive attribute set after you've copied them, and will be copied the next time as well. Requires write-access to the source files. – Nigel Touch Aug 22 '14 at 13:24

There's rsync, but I haven't used in on Windows. The way I normally use it on Linux is:

rsync -avuz src/ remote:dst/

which only sends updates (new and modified files).

share|improve this answer

BitTorrent Sync works wonderfully. It will update automatically whenever you change a file. Peer to peer. Update multiple locations at once if you need to. Easy to use.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .