xcopy is a powerful tool under Windows to do copying. It’s really helpful for me at the time of project deployment. most of of the time, especially with large projects, the binaries, configuration files has to be copied to the deployment folder by excluding the unwanted/ temporary files in the corresponding folders.

It’s possible tp specify the list of files necessary to exclude during an ‘xcopy’ using /EXCLUDE switch. Here’s a simple tip on how to specify multiple exclusion list to the xcopy operation. For e.g you will have to avoid copying .copying obj, .ilk files, Debug, Release folders (if you’ve copied your binaries to a common bin folder) etc..

xcopy /S /I %BIN_HOME%\*.* C:\Delivery\bin /EXCLUDE:excludelist.txt

In the above statement BIN_HOME is an evironment variable. You can also specify exact path to be copied. You can see that at the end of the statement, it’s specified excludefilelist.txt which contains the full path or partial name of files to be excluded. A sample exclude file list may appear as below. Each file to be excluded should be specified in a new line.  At the end you can see to exclude directories, it’s not necessary to specify prefixing . (dot). See the documentation for more information

Sample exclude list file

.pdb
.ilkÂ
.obj
.pch
.exp
.res
.trg
.idb
.tmp
.log
.ncb
.aps
.bsc
.sbr
.scc
Debug
Release