How To Guides Org

Productivity Tip: Copy Files From Subfolders to One Folder

So, you want to become more productive? How about learning how to copy files from subfolders to one specific folder. This could possibly be a huge time-saver! Let’s get to it.

Using The Command Prompt To Copy Files – Simplified

Windows 7 provides several great tools that allow you to copy files more effectively. Unfortunately, most of them are only accessible via the command prompt. There are for example: copy, xcopy and robocopy. All three can be used to become more productive.

1. Step Open a command prompt
2. Step Enter cd C:\pathtoyourfolder **replace pathtoyourfolder with your actual path, e.g. C:\Users\username\Pictures

The Actual Code

3. Step Copy files from subfolders to one folder:
for /f "tokens=*" %a in ('dir /b /s /a-d') do @copy "%a" "C:\YourFolder" /y

Code Explanation

What is does is to look into each subfolder (dir /b /s /a-d) in the current folder and then copy each file in the subfolder. It will copy each file to the folder C:\YourFolder

What is the /y doing? I am using this option to NOT get prompted for overwriting files. If you don’t add /y it will always ask if you want to overwrite files with the same name. So, if you have files in the subfolders with the same name you will have to rename them first.

If you’ve done everything correctly, it will then copy all files within the subfolders and copy them to the folder that you specified:

Next up, are some more productivity tips, so stay tuned for more!