note 87696 added to function.mkdir
| From: | t-k-r at o2 dot pl | Date: | Wed, 17 Dec 2008 09:42:12 +0000 |
| Subject: | note 87696 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-148244@lists.php.net to get a copy of this message | ||
Very simple script, may be useful to someone.
Creating a directory structure liki this:
0 ------ 0
1 1
2 2 -------- 0
3 3 1
4 ... 2
5 3
6 ...
7
[....]
e
f
Used by my as structure to store uploaded files:
someone upload file -> its name + microtime is md5 -> first 3 letters of md5 string are first
3 subfolders in this folder structure, and at least file is stroed with md5 name.
Naturally SQL- or other type - Database is needed to store infos about files position in this
structure.
<?php
for ($a=0;$a<=15;$a++) {
mkdir(dechex($a),0755);
for ($b=0;$b<=15;$b++) {
mkdir(dechex($a).'/'.dechex($b),0755);
for ($c=0;$c<=15;$c++) {
mkdir(dechex($a).'/'.dechex($b).'/'.dechex($c),0755);
}
}
}
?>
----
Server IP: 82.177.164.100
Probable Submitter: 83.12.37.210
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- https://master.php.net/note/edit/87696
Del: integrated -- https://master.php.net/note/delete/87696/integrated
Del: useless -- https://master.php.net/note/delete/87696/useless
Del: bad code -- https://master.php.net/note/delete/87696/bad+code
Del: spam -- https://master.php.net/note/delete/87696/spam
Del: non-english -- https://master.php.net/note/delete/87696/non-english
Del: in docs -- https://master.php.net/note/delete/87696/in+docs
Del: other reasons-- https://master.php.net/note/delete/87696
Reject -- https://master.php.net/note/reject/87696
Search -- https://master.php.net/manage/user-notes.php