批量/蝙蝠复制文件夹和内容一次 [英] batch/bat to copy folder and content at once

查看:225
本文介绍了批量/蝙蝠复制文件夹和内容一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个批处理脚本,做一个副本。我想脚本它来复制整个文件夹。当我要复制一个文件,我这样做

 复制%〜dp0file.txt file.txt的

如果我有一个文件夹这种结构,是有一个命令,而preserving的确切结构一次全部复制其内容这整个文件夹。

  mainfolder /
  FILE1.TXT
  FILE2.TXT
  insidefolder /
     file3.txt
     file4.txt
     file5.txt


解决方案

如果您有 XCOPY ,您可以使用 / E 参数,将复制目录和子目录以及其中的文件,包括维持目录结构空目录

  XCOPY [来源] [目标] / E

I'm writing a batch script that does a copy. I want to script it to copy an entire folder. When I want to copy a single file, I do this

copy %~dp0file.txt file.txt 

If I have a folder with this structure, is there a command to copy this entire folder with its contents all at once while preserving the exact structure.

mainfolder/
  file1.txt
  file2.txt
  insidefolder/
     file3.txt
     file4.txt 
     file5.txt

解决方案

if you have xcopy, you can use the /E param, which will copy directories and subdirectories and the files within them, including maintaining the directory structure for empty directories

xcopy [source] [destination] /E

这篇关于批量/蝙蝠复制文件夹和内容一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆