简体   繁体   English

如何使用批处理文件将文件从父文件夹复制到子文件夹?

[英]How do I copy files from parent folder to sub folders using batch file?

Can anyone help me to solve this problem? 谁能帮我解决这个问题?

Eg : 例如:

  1. FolderA contains 123.txt . FolderA包含123.txt

  2. FolderB contains FolderB1, FolderB2, etc. FolderB包含FolderB1, FolderB2, etc.

I want to copy the files from FolderA to FolderB1, FolderB2, etc. using batch file. 我想使用批处理文件将文件从FolderA复制到FolderB1, FolderB2, etc.

使用for循环遍历目标目录。

FOR /D %%d IN (\Path\to\FolderB\*) DO copy \Path\to\FolderA\123.txt "%%~d"
pushd "\Path\to\folderB"
for /r /d %%a in (*) do cd "%%~fa" & copy "\Path\to\FolderA\123.txt"
popd

暂无
暂无

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

相关问题 如何使用批处理脚本从当前目录复制文件,而不复制子目录? - How do I copy files from the current directory, but not sub-directories using a batch script? 如何仅扫描精确文件名(通过批处理文件)? //如何从不同的子文件夹复制(并保留)同名文件? - How to scan only for EXACT file names (via batch file)? // How to copy (and keep) eponymous files from different sub-folders? 如何使用此批处理文件将所有* .txt文件从子文件夹复制到批处理文件文件夹? - How to copy all *.txt files from subfolder to batch file folder using this batch-file? 如何使用批处理文件将多个文件夹复制到另一个路径? - How do I copy multiple folders to another path with a batch file? 如何计算目录及其子文件夹中所有子文件夹中的所有文件,但返回子文件夹的名称以及文件计数? - How do I count all files in all sub folders in a directory and its sub folders but return the name of the sub folder with a count of the files? 批处理文件可将文件从多个文件夹复制到单个文件夹,如果日期较新则覆盖 - Batch file to copy files from multiple folders to a single folder, overriding if date is newer 如何在批处理文件中将选定的文件从一个文件夹复制到另一个文件夹? - How to copy selected files from one folder to another in Batch file? 批处理脚本复制带有文件的文件夹结构跳过特定的子文件夹 - Batch script to copy folder structure with files skip specific sub-folders 如何使用批处理文件删除父文件夹中的特定子文件夹? - How to delete a specific sub-folder in a parent folder using a batch file? 将所有 usr 文件从子文件夹复制到单独文件夹的批处理脚本 - batch script to copy all usr files from sub folders to separate folders
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM