0

Following

Move all files except some (file pattern) from a DOS command

I want to copy all files from my release dir to the deployment dir with that batch file:

echo off

set "source=.\EasyRun\bin\Release\"
set "destination=C:\temp\EasyRun\"

IF exist %destination%  rd %destination% /s /Q

IF exist %source% ( echo "OK release") ELSE ( echo "NO Realease DIR "%source% && pause && exit )

dir /b /a-d %source%|findstr /b "vshost" > excludeList.txt
xcopy /s %source%"*.exe" %destination% /exclude:excludeList.txt
xcopy /s %source%"*.dll" %destination%

echo "OK!!"
Pause

So here are two problems:

  1. the excludeList is not filled and the file is empty
  2. even when manually I put .\EasyRun\bin\Release*.vshost.exe it the xcopy doesn't exclude it from copying.

enter image description here

thanks

Community
  • 1
  • 1
Patrick
  • 3,073
  • 2
  • 22
  • 60
  • If that is the only file you want to exclude, simply turn off the Visual Studio hosting process in the debugging options for your project. That file will then not get made in the first place. – adrianbanks Dec 28 '15 at 10:19
  • That might do but how to do so. And then this has to be only done for the release folder not debug – Patrick Dec 28 '15 at 10:24
  • 1
    You can disable it in the project settings for the `EasyRun` project (right clock on the project in Solution Explorer and choose `Properties -> Debugging`, then untick the hosting process option). This will turn the generation of that file of (you will have to delete the existing file). As the file is then not made, you won't need to do anything different between debug/release. – adrianbanks Dec 28 '15 at 10:29
  • But what is the effect of that action? And then I have not understood if that has effect on the release only (not debug). Eventually if that is doable and that file is debug-related. Why VS puts it in the RELEASE dir? – Patrick Dec 28 '15 at 10:37
  • 1
    That file is used by Visual Studio for debugging (see http://stackoverflow.com/a/774219/116923 for more info) but you can turn it off. It is put also into the `Release` output because it is possible to debug release builds. – adrianbanks Dec 28 '15 at 10:40
  • Thank you that worked so I upvoted you. Thanx!!! That being said I'd like to know why the batch file does not work. – Patrick Dec 28 '15 at 10:56

1 Answers1

0

It might be caused by the empty excludeList.txt. -> Try to enter a dummy entry

I had some issues with xcopy and network shares. (I got errors due to latency, access restrictions, ...)

I recommend robocopy with the /xf option. e.g. /xf vshost Also the /MT[:N] multi-threaded copies should speed-up the copy process.

schwdk
  • 143
  • 5