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.

Example

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.

Read How to copy a file to multiple folders on Windows 10 by Fatima Wahab on AddictiveTips - Tech tips to make you smarter



from AddictiveTips http://bit.ly/2PRR79K
via IFTTT