Last change
on this file since 10337 was
10337,
checked in by mistic100, 13 years ago
|
new version 1.4, new plugin for Charlies Content, NConvert updated
|
File size:
1.1 KB
|
Rev | Line | |
---|
[9201] | 1 | <?php |
---|
| 2 | /***************************************\ |
---|
| 3 | | PHP OPTIMISATEUR | |
---|
[10337] | 4 | | Plugin CreateFoldersAlpha 1.2 | |
---|
[9201] | 5 | \***************************************/ |
---|
| 6 | |
---|
| 7 | ## Crée une arborescence alphanumérique dans la dossier source |
---|
| 8 | ## Ne supporte pas une arborescence pré-existante |
---|
| 9 | |
---|
| 10 | $handle = opendir($CONF['DIRsource']); |
---|
| 11 | |
---|
| 12 | while ($file = readdir($handle)) { |
---|
| 13 | if ($file != '.' && $file != '..' && !is_dir($CONF['DIRsource'].'/'.$file)) { |
---|
| 14 | // Récupère le parties du nom servant à créer les dossiers |
---|
| 15 | if (preg_match('#^(.{1})([^_.]*)_(.*)#', $file, $matches)) { |
---|
| 16 | $Letter = strtoupper($matches[1]); |
---|
| 17 | $FolderName = $matches[1].$matches[2]; |
---|
| 18 | |
---|
| 19 | // Crée les dossier |
---|
| 20 | if (!file_exists($CONF['DIRsource'].$Letter.'/'.$FolderName)) { |
---|
[10337] | 21 | mkdir_log($CONF['DIRsource'].$Letter.'/'.$FolderName); |
---|
[9201] | 22 | } |
---|
| 23 | |
---|
| 24 | // Déplace le fichier |
---|
[10337] | 25 | rename_log($CONF['DIRsource'].$file, $CONF['DIRsource'].$Letter.'/'.$FolderName.'/'.$file, true); |
---|
| 26 | |
---|
| 27 | } else { |
---|
| 28 | $LOG[] = 'The file '.$CONF['DIRsource'].$file.' doesn\'t match the patern #^(.{1})([^_.]*)_(.*)#, not moved'; |
---|
[9201] | 29 | } |
---|
[10337] | 30 | |
---|
| 31 | $done = true; |
---|
| 32 | } |
---|
[9201] | 33 | } |
---|
[10337] | 34 | |
---|
| 35 | if (isset($done)) $LOG[] = "\r\n"; |
---|
| 36 | |
---|
[9201] | 37 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.