There are many times when it is necessary to make sure that one folder stays in synch with another. The possibilities are endless, but one that I run into a lot is the need to retry copying files to a folder because they were in use when I tried the first time. For example, I may be deploying a new build of Smart Client software but somebody is in the application so it can not be overwritten on the network.
In order to combat this, the solution is simple. Just using the right switches of XCOPY can work pretty smooth. Here is a quick way to recursively copy all files.
That one line in a .bat file can be magic if you want to do the same things that I typically do, which is “Make this folder look like that one and don’t ask me any questions!
REM This is where the actual work is done
If you want more detail on what each of the switches do, here are a few good references:
Filed under: Development |