I was looking around on the User Voice page for Release Management and noticed a feature request about using /exclude flag with the XCopy Deployer tool. The user was requesting the tool be updated to support that option.
My knee jerk reaction was just add a Custom tool yourself that does it! So that is exactly what I am going to show you how to do in this post. Instead of starting from scratch I thought I would leverage the work of the Release Management team and harvest the irxcopy.cmd file and see what they had done. You can see my previous post on how to harvest the out of box tool resources if you need help finding the irxcopy.cmd file.
Once I had a copy of the file I noticed that the tool did appear to support the /exclude flag of xcopy. All the user has to do is provide a file named excludedfileslist.txt in the component's source folder. However, after some testing and further investigation it appears the irxcopy.cmd file has a bug that overwrites the original contents of the file instead of appending to it as intended.
My original excludedfileslist.txt file is below.
This is what it looks like after it is used with irxcopy.cmd.
The irxcopy.cmd file contained the following commands.
As you can see on line 3 the single greater than '>' should be a double greater than '>>'. The single is actually replacing all the contents with irxcopy.cmd instead of adding irxcopy.cmd to the end.
We are going to write our own cmd file named myxcopy.cmd below.
Now all we have to do is add it to the tools inventory and set our component to use our tool instead.
Now our excludedfileslist.txt file looks correct and the xcopy excludes the desired files.