Friday, December 9, 2011

search file with folder path from folder

$directory = "C:/Documents and Settings/capacity/Desktop/Images";
$fileSPLObjects = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory),
RecursiveIteratorIterator::CHILD_FIRST
);
try {
foreach( $fileSPLObjects as $fullFileName => $fileSPLObject ) {
echo "
";
echo '
';

print_r($fileSPLObject);
//$_path=pathinfo($fileSPLObject->getFilename());
//dirname('c:/Temp/x')
//echo $_path['dirname'].$_path['basename'];
}
}
catch (UnexpectedValueException $e) {

printf("Dir [%s] contained a dodgy folder", $directory);
}?>

No comments:

Post a Comment