On *nix boxes with php you could run the following code from a php file in the folder assuming the folder permissions are set correctly.
This code is based on all the file names having three letter extentions and just lops four characters off the end of the filenames to create the folders. It also does not delete the files from the directory from which they are copied.
PHP Code:
<?php
// On *nix boxes this is the full directory path
$directory = "/complete/path/to/directory/";
if (is_dir($directory)) {
if ($contents = opendir($directory)) {
while (($file = readdir($contents)) !hahahaha false) {
if(is_file($file)) {
mkdir( substr($directory . $file, 0, -4) , 0755 );
copy( $directory . $file , substr($directory . $file, 0, -4) . "/" . $file);
}
}
closedir($contents);
}
}
?>
The hahaha should actually be two equals signs.