Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have a system here that recently had a hard drive failure. I was able to use recovery software to get most of the files off of it, but it was not able to retrieve folder names for the most part. Instead, it dumped most everything (some 200,000 files!) into one folder. This is death for the Windows file system.

Can anyone recommend a good (preferably free) program to automatically sort these files into new folders?

In this case, the files are at least already grouped by type. I was thinking to sort by either name, or creation/modified date and then name.

share|improve this question
add comment

3 Answers

Depends on how you want to sort them. Are they all different types? The command line is very handy for that.

example:

C:\>mkdir JPEGS writtendocs spreadsheets
C:\>cd huge_folder
C:\huge_folder\>move *.jpg ../JPEGS
C:\huge_folder\>move *.doc ../writtendocs
C:\huge_folder\>move *.xls ../spreadsheets

There is a free graphical tool to perform similar operations, suitably named File Sort, which can help you sort by file name, age, and size:

alt text

share|improve this answer
add comment

Belvedere from a Lifehacker editor might be useful.

alt text

Use Belvedere's friendly interface to create advanced rules to move, copy, delete, rename, or open files based on their name, extension, size, creation date, and more.

share|improve this answer
add comment

Here's a completely untested :) perl script to sort based on first char in the filename

use File::Copy;

# base directory of where we want to copy files
my $destdir = "destdir";

opendir("dir_to_sort", DH);
my @files = readdir(DH);
closedir(DH);
foreach my $file (@files)
{
   # skip . and ..
   next if $file =~ /^\.$/;
   next if $file =~ /^\.\.$/;

   # This is where you'd figure out where you want to put the file
   # in this example we're just looking at the first char.
   # so a file named "HelloWorld" would be copied to $destdir/H/HelloWorld
   # pull the first char
   $file =~ /^(.).*/;
   my $target_dir = $1;

   mkdir("$destdir/$target_dir") unless -d "$destdir/$target_dir"

   # you could use move instead of copy here
   copy($file, "$destdir/$target_dir/$file");
}

Really, this is totally untested, if you lose everything by running this, don't complain I didn't warn you. :)

share|improve this answer
1  
perl script - for a windows machine? I suppose it's no worse installing perl than anything else, but... ugh –  Joel Coehoorn Jan 27 '10 at 19:26
    
lol file sort works well. –  Kelbizzle Jan 27 '10 at 19:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.