function GlobRecursif ($Pattern="", $Directory="", DirOnly="", FollowLinks="") { $FollowLinks = ! strcasecmp($FollowLinks, "FollowLinks"); if ($Directory=="") { $Directory = "."; } if ($Pattern=="") { $Pattern = "*"; } $GlobRecursif = [] if ($DirOnly=="DirOnly") { $p = "$Directory/$Pattern"; foreach ( glob($p, GLOB_ONLYDIR) as $Dir if ( ! $FollowLinks && is_link($Dir) ) { continue; } $GlobRecursif[] = $Dir; } } else { #ici on peut aussi choper les dir si pattern matche une dir foreach Local [lsort [glob -nocomplain -- [file join $Directory $Pattern]]] { if {! $FollowLinks && [file type $Local]=="link"} { continue } set Local [encoding convertto [encoding system] $Local] lappend GlobRecursif $Local } } foreach Dir [lsort [glob -nocomplain -type "d" -- [file join $Directory *]]] { if { ! $FollowLinks && [file type $Dir]=="link"} { continue } set Dir [encoding convertto [encoding system] $Dir] foreach SousLocal [GlobRecursif $Pattern $Dir $DirOnly] { lappend GlobRecursif $SousLocal } } return $GlobRecursif } function glob_recursive($pattern, $flags = 0) { $files = glob($pattern, $flags); foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { $files = array_merge($files, glob_recursive($dir.'/'.basename($pattern), $flags)); } return $files; } echo "
";
	   $path = "$top/mosaique/$rep/www01/timbres";
	   echo $path;
	   echo "
"; $lesTimbresPath = glob_recursive("{$path}/*.jpg"); foreach ($lesTimbresPath as $timbrePath) { $timbre = preg_replace("@$top@", "", $timbrePath); $photo = preg_replace("@/www01/timbres@", "", $timbre); $titre = $timbre; echo "
"; echo $timbre; #echo ("\n"); }