繁体   English   中英

复制文件夹内容

[英]copying folder content

我正在编写批处理脚本,需要将某个文件夹的内容复制到另一个文件夹。

例如我有文件夹

source/
  file1.txt 
  file2.txt 
  file3.txt 

并且我在目标文件夹中有文件。 我如何将source的内容复制到destination以便最终目标看起来像这样

destination/
  existing1.txt
  existing2.txt
  file1.txt 
  file2.txt 
  file3.txt 

我尝试了xcopy,但不能完全正确。

只需使用通配符:

xcopy source\*.* destination\*.*

使用上述通配符,您可以轻松地将内容从一个文件复制到另一个文件。

例如,如果您的源文件夹和目标文件夹位于桌面上,则可能具有以下内容:(用PC或笔记本电脑的名称替换“ YOURNAME”)

@echo关闭> * .txt

setLocal DisableDelayedExpansion

设置dest =“ C:\\ Documents and Settings \\ YOURNAME \\ Desktop \\ destination”

xcopy“ C:\\ Documents and Settings \\ YOURNAME \\ Desktop \\ source \\ *。txt”%dest%/ E / I

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM