Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I created a sample bat file in order to have a back-up system. this does not show what my intention is but it demonstrates it. here is my bat file content;

xcopy C:\apps\source c:\apps\dest /D /E /C /R /H /I /K /Y

what I want is this;

I want to copy every updated file and sub-folders from source folder to dest folder. is this code is ok for that. thanks !

share|improve this question
    
I recommend a source control software, as Mercurial, Git or SVN, that stores old files as revisions and you can access them to compare with current version. But you can do it with a Windows batch file, using that xcopy plus fc command to copy only modified files, but you have to have a copy of all files in the older version in another folder to compare - so it is easier to have a done solution with mentioned software. –  kokbira Apr 25 '11 at 14:24
add comment

3 Answers

up vote 2 down vote accepted

Xcopy's performance and features leave a lot to be desired compared to the alternatives.

Have a look at Richcopy - it's Robocopy on steriods and also from Microsoft. Richcopy is also Multithreaded (Robocopy only became multithreaded with the Windows 7 version) and so it's throughput is quite impressive.

http://technet.microsoft.com/en-us/magazine/2009.04.utilityspotlight.aspx

http://www.servermigrator.com/blog/2009/08/11/the-easiest-way-to-prepare-richcopy-command-line-parameters/

share|improve this answer
    
Actually Linker3000, I don't believe Robocopy is multithreaded even on Windows 7. So Richcopy might be a better option, especially if dealing with large numbers of files. Thanks for posting! –  Joshua Apr 20 '11 at 13:37
add comment

You need /S /E rather than /E on it's own.

And if it's a backup system, you probably don't want to supress errors with a /C, but to react to them.

share|improve this answer
add comment

I recommend using robocopy, which is part of Windows 7 / Server 2008. More information here: http://en.wikipedia.org/wiki/Robocopy

This tool provides a bunch of options, not the least of which is an ability to "mirror" your locations and copy only the changes (so you don't have to do the entire file dump again, which saves a LOT of time if you are dealing with large or large numbers of files).

Example of mirror, copying only changes:

robocopy C:\data E:\data /MIR /Z
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.