tags:

views:

16

answers:

2
$path-/home/acname/public_html/storage
$array= (0,1,2,3,4,5,6,7,8,9,a,b, etc.. z);??

using mkdir(); ???

I want to make directories named 0-9 and a-z each with subdirectories in each one 0-z;

eg:

/home/acname/public_html/storage/0/0

all the way to

/home/acname/public_html/storage/9/z

and

/home/acname/public_html/storage/a/0

all the way to

/home/acname/public_html/storage/a/z

continue until ~~~

/home/acname/public_html/storage/z/0

all the way to

/home/acname/public_html/storage/z/z

This will be a one timer I think but far faster than doing it via an ftp client. Figuring this out myself would take longer than the ftp client method! I will learn in the process too.

Thanks in advance!

+1  A: 
<?php
   $chars = array(0,1,2,3,4..... ,'x','y','z'); // too lazy to type them all out
   foreach($chars as $first) {
      mkdir("/home/acname/public_html/storage/{$first}");
      foreach($chars as $second) {
          mkdir("/home/acname/public_html/storage/{$first}/{$second}");
      }
   }
?>
Marc B
+1  A: 
$names = array_merge(range(0,9), range('a', 'z'));
$path  = '/home/acname/public_html/storage/';

foreach($names as $cName) {
  mkdir($path . $cName);
  foreach($names as $cName2) {
    mkdir($path . $cName . '/' . $cName2);
  }
}
sled
Pehaps you can help me with this one too: http://stackoverflow.com/questions/3704165/php-alpha-sort-lines-from-several-files-in-one-directory-and-save-them-to-files
Jim_Bo
THANK YOU BY THE WAY! Answered and +1
Jim_Bo