View Single Post
Old 02-16-2005, 06:07 AM  
broke
Confirmed User
 
Join Date: Aug 2003
Location: Someplace Windy
Posts: 4,501
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)) {

        
mkdirsubstr($directory $file0, -4) , 0755 );
        
copy$directory $file substr($directory $file0, -4) . "/" $file);

       }

       }

       
closedir($contents);
   }
}

?>
The hahaha should actually be two equals signs.
broke is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote