Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to extract certain files (only a handful of extensions) from a USB HDD that contains more than 2 million files (in all possible formats and nested in several layers of subfolders).

Can anybody suggest me a nice utility to take care of this extremely time consuming task?

Ideal scenario: I set the parameters (the actual extensions that I really need), I run the tool and the morning after I find on my USB HDD only the few folders (named something like "doc & docx", "xls & xlsx", "pdf", "zip"... etc) that contain my files... Nothing else, no empty folders and no other files except these having the extensions that I indicated. Eventual filename conflicts to be solved with an appended progressive number (or custom text)... Error logging could be a plus (since I have the exact same copy on a second HDD from which I could eventually "pluck out" some accidentally deleted files/folders). I will take care of duplicates at a later stage but if this "wonder tool" could reliably do that I would obviously not mind ;)

Thanks for any creative suggestion

share|improve this question
Whip something up with find(1) from Unix would be a simple task, dunno if you are confortable with e.g. CygWin. – vonbrand Feb 6 '13 at 19:02
up vote 0 down vote accepted

Thanks for your suggestion but I concluded that I will solve this issue with a batch script... I put it together and it is getting the job done just as I need it. Once more I have been amazed by the fact that the commands of a batch file can be quite powerful/useful!

A simple Notepad created script is now doing the job without downloading/installing anything and without involving Windows Explorer, which clearly cannot handle folders containing too many files.

Sometimes the easiest solution is indeed the best!

_____________________ EDIT:

As I said in the pre-edit part, the script is extremely simple and since this is a very customized operation (it is not much the script but rather the procedure I used that got me what I wanted in a fraction of the time) I doubt that another user will find it operable "as is" but in the hope that somebody else will find what I did useful to quickly move (only) a few thousands needed files out of a very large group of files accumulated over the years on an external HDD I wrote a memo to point in the general direction, then whoever may stumble upon this Q&A will have to adapt my method to his/her needs.

Since the data I needed to extract from the HDD is quite sensitive (and valuable to me) I intentionally wanted to follow each step and created therefore individual scripts for each group of extensions (I also purposely did not @echo off to take a glimpse of what was being moved)... Obviously the same procedure can also be run (semi-)unattended.

Here you go:

1) Make sure that the external HDD partition from which files are to be collected has the letter "Y" allocated (for this particular script that letter was used but obviously any other available letter can be used).

2) In "Y" place all folders (from which files are to be collected) into a single folder named "- All" (for this particular script... any other name can be used).

3) Use the great freeware called Suction (Google "suction dr nathan" to find it) and Suction the "- All" folder to move all files to the 1st level and also to rename all files which have the same name. (NOTE: I intentionally did not use the available "Delete Duplicates" option to proceed faster)

4) Execute "Create folders in the root (Y drive).bat" to create all necessary folders to host the (extension sorted) files... Something like that (customize as needed):

mkdir "Y:\ALL Archive files"
mkdir "Y:\All Excel files"
mkdir "Y:\All PowerPoint files"
mkdir "Y:\All Word files"

5) As applicable execute one by one the other batch scripts* to move the necessary files to their designated destinations... Something like that (customize as needed):

move /-y "Y:\- All\*.zip" "Y:\ALL Archive files"
move /-y "Y:\- All\*.rar" "Y:\ALL Archive files"

move /-y "Y:\- All\*.xls" "Y:\All Excel files" 
move /-y "Y:\- All\*.xlsx" "Y:\All Excel files" 

move /-y "Y:\- All\*.pps" "Y:\All PowerPoint files" 
move /-y "Y:\- All\*.ppsx" "Y:\All PowerPoint files" 
move /-y "Y:\- All\*.ppt" "Y:\All PowerPoint files" 
move /-y "Y:\- All\*.pptx" "Y:\All PowerPoint files" 

move /-y "Y:\- All\*.doc" "Y:\All Word files"
move /-y "Y:\- All\*.docx" "Y:\All Word files"
move /-y "Y:\- All\*.rtf" "Y:\All Word files"

6) Use your favorite search tool (I used Everything) to check if any files with the specified extensions have been left behind in the "- All" folder (don't know why 2 or 3 files were indeed left behind... Inexplicable! Anyway I moved those manually)

7) Run your favorite duplicate finder to get rid of eventual dupes

8) Remove any unnecessary file that might have been "caught in the middle" (I found a bunch of files that I did not need to keep so I trashed them at this stage)

9) Rename/consolidate the hosting folders in the root of "Y" (if applicable)

10) Delete the "- All" folder once safe to do so (I triple-checked that what was left there was indeed to be trashed)

*(if necessary compile new scripts for other extensions and also the necessary hosting folders in the root of "Y")

share|improve this answer
If you're going to self-answer, take the time to provide the actual answer, i.e. the batch file in question. This is a Q&A site whose motive is to help future readers as well, and not just the person who posts the question. Hence just posting that you "figured it out" without precisely stating how does not help anyone else. – Karan Feb 7 '13 at 23:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .