问题描述
我似乎无法找到在命令行的方式说:从目录中的所有文件复制到目录B,但该文件中目录B中已经存在,不要覆盖它,无论哪文件更新,并且不提示我。
我已经通过复制,移动,XCOPY和放大器;的Robocopy,和最近的我能得到的是,你可以告诉的Robocopy复制A到B,但不与旧的文件覆盖较新的文件,但是,这并不为我工作。我看着XXCOPY,但它丢弃,因为我不希望有一个Visual Studio生成后事件,将需要其他SVN用户有安装工具,为了做构建第三方的依赖。
我要添加一个命令行的生成后事件在Visual &工作室NBSP; 2010以便该从的新模型对象模板获得分配给其所属的项目文件夹,但现有对象再生文件没有覆盖潜在的编辑的目标文件。
由于T4模板重新生成,源文件始终是新的,我不能用新的切换可靠,我不认为。
我使用部分类的物品,我可以,但也有其他的事情我产生不能使用部分类(例如生成一个默认EditorTemplate或DisplayTemplate * .ascx文件)。
任何一个有他们解决任何类似的问题?
对于%F在(C:\\从\\ *。*)做,如果不存在C:\\到\\%〜NXF复制%FC:\\到\\%〜NXF
I just can't seem to find a way on the command line to say "copy all the files from directory A to directory B, but if the file already exists in directory B, don't overwrite it, no matter which file is newer, and don't prompt me."
I have been through copy, move, xcopy & robocopy, and the closest I can get is that you can tell robocopy "copy A to B, but don't overwrite newer files with older files," but that doesn't work for me. I looked at xxcopy, but discarded it, as I don't want to have a third-party dependency on a Visual Studio post-build event that will require other SVN users to have that tool installed in order to do the build.
I want to add a command line to the post-build event in Visual Studio 2010 so that the files that are generated from the T4 templates for new EF model objects get distributed to the project folders to which they belong, but regenerated files for existing objects don't overwrite potentially edited destination files.
Since the T4 template regenerates, the source file is always newer, and I can't use the "newer" switch reliably, I don't think.
I use partial classes for those items for which I can, but there are other things I generate that can't use partial classes (e.g. generating a default EditorTemplate or DisplayTemplate *.ascx file).
Any one have any similar problems they have solved?
For %F In ("C:\From\*.*") Do If Not Exist "C:\To\%~nxF" Copy "%F" "C:\To\%~nxF"
这篇关于复制文件,而不覆盖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!