如何一个文件夹复制到文件夹的所有其他子文件夹? [英] How to copy one folder to all other subfolders of a folder?
问题描述
我要文件夹复制图片
到一个文件夹中的所有其他文件夹。
I want to copy folder IMAGE
to all other folders in a folder.
文件夹结构是:
- 测试文件夹
- FirstSubFolder
- 图片
- OneMoreSubFolder
- 测试文件夹1
- TestFolder2
结果应该是:
- 测试文件夹
- FirstSubFolder
- 图片
- Test folder
- FirstSubFolder
- IMAGE
- 图片
- IMAGE
- 图片
- IMAGE
- 图片
- IMAGE
哪些命令,我需要一个批处理脚本做这个文件夹复制任务?
Which commands do I need in a batch script to do this folder copying task?
推荐答案
通过
测试文件夹
是当前目录,使用下面的批处理code:With
Test folder
being the current directory use following batch code:@echo off for /D %%D in (*) do ( if /I not "%%D" == "IMAGE" ( xcopy "IMAGE\*" "%%D\IMAGE\" /C /E /H /I /K /Q /R /Y >nul ) )
或者,如果只是在
映像的文件和子文件夹
应该被复制到测试文件夹
的其他所有子文件夹,使用这code:Or if just the files and subfolders in
IMAGE
should be copied to all other subfolders ofTest folder
, use this code:@echo off for /D %%D in (*) do ( if /I not "%%D" == "IMAGE" ( xcopy "IMAGE\*" "%%D\" /C /E /H /I /K /Q /R /Y >nul ) )
有关理解使用的命令以及它们如何工作,打开命令提示符窗口中,执行有下面的命令,并阅读完全针对每个命令显示的所有帮助页面非常谨慎。
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
-
回声/?
-
为/?
-
如果/?
-
XCOPY /?
echo /?
for /?
if /?
xcopy /?
这篇关于如何一个文件夹复制到文件夹的所有其他子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- FirstSubFolder
- FirstSubFolder