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.

How to copy files from subfolders

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. Open a command prompt
2. Enter cd C:\pathtoyourfolder **replace pathtoyourfolder with your actual path, e.g. C:\Users\username\Pictures

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

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:

Copy files from subfolders

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


Or you might like these sexy wallpaper, tweaks and themes:

Tags: Written by oliversk Wednesday, September 15th, 2010

Was it helpful? Please bookmark it and spread the word

delicious   facebook   google   twitter  

You love Windows, Gaming and everything digital? Great, we too! We have thousands of great Windows 7 themes, registry tweaks, tutorials, so please use our search box if you look for anything specific. If you have some awesome desktop themes, tips or want to write for us, then drop us a mail: win7themes at googlemail.com

2 Responses to Productivity Tip: Copy Files From Subfolders to One Folder

  1. Wilkie IT said:

    This does not work keep getting error *” was unexpected at this time.
    code was
    for /f “tokens=*” %a in (‘dir /b /s/a-d’) do @copy “%a” “d:\new\rar” /y

  2. Wilkie IT said:

    I have got this working. with the following

    for /f “tokens=*” %a in (‘dir /b /s /a-d “c:\test”‘) do @copy “%a” “d:\new\rar”

    It appears you left out the source folder (c:\test) in your example.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>