默认情况下,从命令提示符进行复制将提示您覆盖目标位置中已存在的文件.
您可以添加"/ Y"来表示"是对所有人"替换.
但你怎么能说"不对所有人"?
换句话说,我要复制一切从一个目录,它不是已经在目标存在.
我看到的最接近的是XCOPY参数,只能在特定的mod-datetime之后复制东西.
除非您不希望复制自上次复制以来已更改的源中的现有文件,否则为什么不在不指定日期的情况下将XCOPY与/ D一起使用?
echo "No" | copy/-Y c:\source c:\Dest\
您可以使用单个长行"n"创建一个文本文件,然后运行您的命令并在其后面输入 或者你可以用一些东西按住n键,但这需要比使用<管道输入更长的时间.
这是一个解决方法.如果要复制B中尚不存在的A中的所有内容:
将A复制到新目录C.将B复制到C,覆盖与A重叠的任何内容.将C复制到B.
我使用XCOPY
以下参数来复制.NET程序集:
/D /Y /R /H /D:m-d-y - Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. /Y - Suppresses prompting to confirm you want to overwrite an existing destination file. /R - Overwrites read-only files. /H - Copies hidden and system files also.
我知道你们都认为/ D:日期会使用日期的东西,但只有/ D没有:确实是我们想要的......
xcopy {Source} {Destination} /E /D
在没有覆盖的情况下进行复制,以便在出于某种原因之前拾取那些新的或可能失败的文件.
试试吧,它有效.
我希望xxcopy有一个选项.
答对了:
http://www.xxcopy.com/xxcopy27.htm#tag_231
2.3 By comparison with the file in destination The switches in this group select files based on the comparison between the files in the source and those in the destination. They are often used for periodic backup and directory synchronization purposes. These switches were originally created as variations of directory backup. They are also convenient for selecting files for deletion. 2.3.1 by Presence/Absence The /BB and /U switches are the two switches which select files by the pure presence or absence as the criteria. Other switches in the this group (Group 2.3) are also affected by the file in the destination, but for a particular characteristics for comparison's sake. /BB Selects files that are present in source but not in destination. /U Selects files that are present in both source and destination.
-亚当