Skip to content

Instantly share code, notes, and snippets.

@jake-yeg
Created February 7, 2017 09:23
Show Gist options
  • Save jake-yeg/a67aff1776c50afad3d7fecaafe7daa9 to your computer and use it in GitHub Desktop.
Save jake-yeg/a67aff1776c50afad3d7fecaafe7daa9 to your computer and use it in GitHub Desktop.
<?php
$Directory = new RecursiveDirectoryIterator('path/to/project/');
$Iterator = new RecursiveIteratorIterator($Directory);
$array = new RegexIterator($Iterator, '/^.+\.jpg$/i', RecursiveRegexIterator::GET_MATCH);
foreach($array as $arr){
if(preg_match('/.*[0-9].(?:jpg)/',$arr) || strpos($arr,'coverleft') !== false || strpos($arr,'coverright') !== false){
echo $arr . ' Was Found ' . PHP_EOL;
}
else{
echo $arr . ' Not Found ' . PHP_EOL;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment