0

I'd like to copy project files and folders to the bin\debug folder on successful build. I'm trying to get xcopy to do it, but it either copies 0 files or tells me it can't copy cyclicly.
What I'm trying to do is similar to this question: Here's my batch file:

@echo off

REM Set up the files and folders to exclude
echo \bin\ > exclude.txt
echo exclude.txt >> exclude.txt
echo Helper.cs >> exclude.txt
echo Program.cs >> exclude.txt

REM Set up the variables
set sourceBase="D:\Devprojects\WebApplications\GenerateTabbedHTML"
set destinationBase="D:\Devprojects\WebApplications\GenerateTabbedHTML\bin\Debug\"
set params=/E /C /I /R /Y /Exclude:exclude.txt

xcopy %sourceBase% %destinationBase% %params%

Am I going about this the right way? Or is there an easier way to accomplish this?

Community
  • 1
  • 1
Dave Harding
  • 1,280
  • 2
  • 16
  • 31

1 Answers1

1

Looks like xcopy doesn't like the fact that your dest folder is inside your source folder. You do exclude it, but I guess it can't handle the situation anyway. Try using an intermediate folder, which is not under the source. Have the files first copied there, and then to the target.

Eran
  • 21,632
  • 6
  • 56
  • 89