October 22nd, 2020 – How to Copy Files from Multiple Sub-folders to a Single Folder?

When importing photos from your camera or SD card via AutoPlay dialog using the Photos app, many sub-folders (month and year-wise) are created in the destination folder, which may not be what you wanted. Here is a step-by-step guide which explains how to move all files recursively from multiple sub-folders to a single folder of your choice.

Copying the files from each sub-folder to a single folder manually can be a tiresome task especially if you have a large number of folders. However, you don’t need to dig into each and every folder to do that, as there are several ways to quickly copy or move files from all the sub-folders to a single folder — i.e., flatten a directory structure.

Flattening a directory structure
Move or Copy Files in Sub-folders to a Single Folder
Method 1: Using Command Prompt

You can copy or move files from sub-folders to a single folder using at least three different built-in ways in Windows. This procedure is also known as flattening a directory structure.

Method 1: Using Command-line
Scenario: Let’s copy all files from the d:\vacation snaps\2016 folder and sub-folders to the d:\all snaps folder recursively.

Open a Command Prompt window.
Run the following commands one by one and press ENTER after each line:
md “d:\all snaps”
cd /d “d:\vacation snaps\2016”
for /r %d in (*) do copy “%d” “d:\all snaps\”
This recursively copies all files in the d:\vacation snaps\2016\ folder to the d:\all snaps\ folder. To move the files, replace copy with move

If a file of the same name exists in the destination, you’ll be asked if you want to overwrite or skip the file.

Note: It’s always safe to include the trailing backslash () after the destination folder path, as in the above example. Because, without the trailing slash, if the destination path is missing and you run the command, then the files in the folder and subfolders are copied and combined into one single file named all snaps to D:\ drive.

https://www.winhelponline.com/blog/move-copy-files-multiple-sub-folders-single-folder/#:~:text=In%20the%20Move%20Items%20dialog,to%20the%20destination%20folder%20chosen.

Published by Leonardo Tomás Cardillo

https://www.linkedin.com/in/leonardocardillo

Leave a comment

Design a site like this with WordPress.com
Get started