Question

I am trying to run xcopy that copies files excluding .obj, etc. What I am seeing is that Microsoft.Practices.ObjectBuilder.dll is not copied when my excludes.txt file contains .obj as an extension. When .obj is removed, I Microsoft.Practices.ObjectBuilder.dll is copied correctly. This does not happen to other dlls though.

Does anyone have any idea why this would happen?

Thanks!

Lenik

Was it helpful?

Solution

I guess because the substring .obj is found in the name Microsoft.Practices**.Obj**ectBuilder.dll and since windows is not case sensitive, it will exclude it.

OTHER TIPS

Yeah, xcopy is dumb like that.

Do this:

dir /b *.obj >excludes.txt
xcopy * /exclude:excludes.txt targetdir

although this will still have the problem sometimes.

If you had a file called practices.obj, for example, it wouldn't copy that, but it would also fail to copy your Microsoft.Practices.ObjectBuilder.dll

A handy trick is if you specify /s on dir, you get recursion and the full path, then if you specify the source directory fully on the xcopy, the excludes will have to match from the beginning:

dir /s /b *.obj >excludes.txt
xcopy c:\sourcedir\* /exclude:excludes.txt \targetdir

Now Microsoft.Practices.ObjectBuilder.dll would only fail to copy if you happen to have a Microsoft.Practices.obj file in the same directory. Get it?

XCOPY is deprecated now anyway, so I doubt things are going to get fixed. Take a look at ROBOCOPY - it's built into Vista, and comes in the resource kit for 2003 and XP.

The answer is what you could obtain by typing:

xcopy /?

Namely:

/EXCLUDE:file1[+file2][+file3]...
Specifies a list of files containing strings. Each string should be in a separate line in the files. When any of the strings match any part of the absolute path of the file to be copied, that file will be excluded from being copied. For example, specifying a string like \obj\ or .obj will exclude all files underneath the directory obj or all files with the .obj extension respectively.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top