将文件复制到同一目录中的多个文件夹 [英] Copying a file to multiple folders in the same directory

查看:509
本文介绍了将文件复制到同一目录中的多个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文件,让我们将其命名为EXAMPLE.DBF

I have a file, lets call it EXAMPLE.DBF

此文件的位置为C:\EXAMPLE.DBF

现在,我想将此文件复制到另一个位置的多个文件夹中. 这些文件夹是dated子目录,因此它们被命名为20140101-20141231,并且它们的位置在d:\bootd\hello\20140101 - 20141231中. 不仅如此,文件夹中已经存在一个名为EXAMPLE.DBF的文件...因此它将要求复制并替换". 我将需要c:\ EXAMPLE复制并替换位于其他位置的365文件夹(20140101-20141231)中的现有Example.DBF.

Now I would like to copy this file into multiple folders at another location. These folders are dated Sub-directories so they are named 20140101 - 20141231 and their location would be in d:\bootd\hello\20140101 - 20141231 Not only that but a file named EXAMPLE.DBF already exists in the folders...so it will ask to Copy and Replace. I will need c:\EXAMPLE to copy and replace the existing EXAMPLE.DBF in 365 folders (20140101-20141231) in a different location.

如果有人可以帮助我,我将非常感激.

If anyone could help me out with this I will be truly grateful.

推荐答案

直接从提示符

for /d %a in (d:\bootd\hello\2014*) do copy /y C:\EXAMPLE.DBF %a\

将C:\ EXAMPLE.DBF复制到与模式2014*匹配的d:\ bootd \ hello \的每个目录(即,简单地启动2014),如果存在,则替换该子目录中的所有现有example.dbf那就是你想做的.

Will copy C:\EXAMPLE.DBF to each directory of d:\bootd\hello\ which matches the pattern 2014* (ie. simply starts 2014), replacing any existing example.dbf in that subdirectory, if that is what you want to do.

要抑制每个生成的1 file(s) copied消息,只需将>nul附加到上一行.

To suppress the 1 file(s) copied messae generate for each, simply append >nul to the above line.

这篇关于将文件复制到同一目录中的多个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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