|
Posted by Toby A Inkster on 08/01/07 11:55
J. Frank Parnell wrote:
> I got this directory tree listing function somewhere, it works great,
> but I want it to only list directories that do have one or more .jpgs
> inside.
It's a bit of a cheat, but...
<?php
function find_dirs_with_jpegs ($path)
{
$path = addslashes($path);
$find = "find '{$path}' -iregex '.*\\.jpe?g' -printf '%h\\n'";
$dirs = explode("\n", `$find | sort -u`);
array_pop($dirs);
return $dirs;
}
?>
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 41 days, 15:27.]
demiblog 0.2.2 Released
http://tobyinkster.co.uk/blog/2007/07/29/demiblog-0.2.2/
Navigation:
[Reply to this message]
|