Easiest way to extract the contents of many folders at once?

29

15

In Windows 7, I have a directory of folders which each contain files as their contents. Is there any way to extract all of the contents of each the folders to a separate location other than cutting and pasting the content one folder at a time?

John Dream

Posted 2012-12-24T18:53:49.900

Reputation: 437

Answers

60

If you want to move the contents of a source directory and all of its sub-directories to a single destination directory (i.e. flatten the folder structure), it's very easy and you don't even need to bother with the command line.

Just go to the top-level source folder (whose contents you want to copy), and in the Windows Explorer search box type * (just a star or asterisk). This will display every file and sub-folder under the source folder. Now just sort by Type to group all files together, select them all, then cut/copy and paste in the destination dir.

If you have hidden and system files as well, under Organize → Folder and search options → View tab make sure Show hidden files... is selected, and Hide protected operating system files is unchecked.

Karan

Posted 2012-12-24T18:53:49.900

Reputation: 51 857

8This, my friend, is why I go to SU as often as I can. DAMN FINE – t0mgs – 2016-02-27T22:04:46.110

1The real life-hack +1 – adelriosantiago – 2016-07-09T21:32:34.177

1Great answer, Would never have thought of this, I was toying with XCOPY and things and was moments away from cracking out AHK. +1. – ATaco – 2016-12-22T06:12:50.890

Hmm I just tried it with Windows 10 and the folders got preserved... – JohnAndrews – 2017-02-27T13:43:32.923

3@JohnAndrews: Nope, still works fine in all versions of Win10 as long as you select only the files. – Karan – 2017-05-16T02:31:39.273

This is a good answer but please add a warning: if some of the files have identical names across subfolders, and you say "yes" to the replace all question, you will lose files. The way to avoid this is to COPY rather than CUT. – aparente001 – 2018-02-09T13:28:00.690

5

You can use Windows Command Prompt for running a command:

move C:\path\to\folder\*\* C:\path\to\folder\


I am not 100% certain about dashes, but \ or / should definetely work. The above command will move all files from all folders in C:\path\to\folder to C:\path\to\folder.

Ernestas

Posted 2012-12-24T18:53:49.900

Reputation: 605

ill play around with it. i figured there was a command prompt solution im assuming for all of them id use the wildcard '*' – John Dream – 2012-12-24T20:34:36.173

Be warned that this will clobber any duplicate filenames. – Bob – 2014-01-28T14:19:01.547