Copying a file to multiple folders in the same directory

前端 未结 2 1016
故里飘歌
故里飘歌 2021-01-03 05:52

I have a file, lets call it EXAMPLE.DBF

The location of this file is C:\\EXAMPLE.DBF

Now I would like to copy this file into multiple folders at

相关标签:
2条回答
  • 2021-01-03 06:33

    Just a small addition to @Magoo's answer;

    in case the destination folders have spaces in their names, use double quotes like this: for /d %a in (d:\bootd\hello\2014*) do copy /y C:\EXAMPLE.DBF "%a\"

    and as pointed out by @ian0411, in case source folder has spaces in its name, use double quotes like this: for /d %a in (d:\bootd\hello\2014*) do copy /y "C:\EXAMPLE.DBF" %a\

    0 讨论(0)
  • 2021-01-03 06:42

    Directly from the prompt,

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

    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.

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

    0 讨论(0)
提交回复
热议问题