1. Home
  2. Windows Tips
  3. Copy a file to multiple folders on windows 10

How to copy a file to multiple folders on Windows 10

Drag & drop makes it incredibly easy to copy or move files and folders. If you need to copy a file to multiple folders, you can hold down the Ctrl key, and drag the file or folder on to each folder you want to copy it to. This is time consuming since you still have to drop the file on to every single folder you want to copy the file (or folder) to. If you need to copy a file to multiple folders and there are a lot of folders that you need to copy the file to, you can use a batch file and do it all in one go.

If you need to copy multiple files to the same folder, consider using this little trick that lets you send files to a folder from the context menu.

Copy a file to multiple folders

This batch script has one limitation; the folders you copy the file to have to be in the same folder. It won’t work if the folders are all in different places.

Open Notepad and paste the following in it. You will need to make edits to this script before you can save it.

@echo off
for /D %%a in ("path-to-folder\*.*") do xcopy /y /d path-to-file\file.FileExt "%%a\"

The first edit you have to make is this path (“path-to-folder\*.*”). Change this path to the path of the folder that has the other folders in it. For example, let’s say you have a folder called Games and inside are three folders named 1, 2, and 3. In that case, you need to enter the complete path to the Games folder. Leave the *.* at the end and don’t remove any brackets or quote marks.

The second edit you need to make is to this path path-to-file\file.FileExt. Replace it with the path to the file that you want to copy to the other folders. Include the file name and its extension. If you have spaces within the path, or in the file name, enclose it in double quotes.

Save the Notepad file with the BAT file extension, and run it. The file will be copied to all sub-folders.


This is what the code looks like after I edited it to copy a file named MyFile.txt located at C:\Users\fatiw\Desktop\Test to all sub-folders under C:\Users\fatiw\Desktop\Newfolder.

@echo off
for /D %%a in ("C:\Users\fatiw\Desktop\Newfolder\*.*") do xcopy /y /d C:\Users\fatiw\Desktop\Test\MyFile.txt "%%a\"

If you don’t want to use a batch script, you can use this same bit of code with minor edits and run it directly in Command Prompt. The edited code looks like this;

for /D %a in ("c:\path-to-folder\*.*") do xcopy /y /d c:\test\file.FileExt "%a\"

We’ve only made two changes to it; the @echo off has been removed and one of the % signs has been removed. You will still need to edit the command and add the paths to the file and folders but with Command Prompt you will be able to see progress as well.


  1. Hi,

    there are subfolders in the main folder, for instance, in the main folder ( games ), there are 10 subfolders. these subfolders are named 1 to 10. and i need to copy a file to selected or certain subfolders ( for example, to 1,2, 4, 6 and 8 only), what will the code be in this case?

    thanks a lot for your help.

    • You can copy and paste the script directly as we have it. The files that you are inputting should not have spaces between them, but brackets. For example: “\Users\User\Desktop\Newfolder”

      I hope this helps!

  2. Great code, but it’s missing 2 double quotes on each side of the copying file path.
    It’s correct on the video, but it’s not on the written tutorial above.

  3. Thanks for the guide, I only have one problem.
    The batch file(therefore the task in task scheduler) wont run. I can run the command directly from cmd with one % sign, but it doesnt work with the .bat

  4. THANKS SO MUCH for this tip.

    It saved me a lot of time and no doubt, a few mistakes during the process of copying two files to 183 folders.

    I’ve no doubt it will be doing so many times in the future as well!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.