Core/Folder.php
public static function find($fileName = false, $path = false) {

        if($fileName) {

            if(!$path) {

                $path = __DIR__;
            }

            if(self::isFolder($path)) {

                $dir = new \RecursiveDirectoryIterator($path);
                foreach (new \RecursiveIteratorIterator($dir) as $filePath) {
                    
                    if($fileName == basename($filePath)) {

                        return $filePath;
                    }
                }
            }
        }

        return false;
    }
public static function find($fileName = false, $path = false) {

        if($fileName) {

            if(!$path) {

                $path = __DIR__;
            }

            if(self::isFolder($path)) {

                $dir = new \RecursiveDirectoryIterator($path);
                foreach (new \RecursiveIteratorIterator($dir) as $filePath) {
                    
                    if($fileName == basename($filePath)) {

                        return $filePath;
                    }
                }
            }
        }

        return false;
    }
public static function find ( $ fileName = false , $ path = false ) { if ( $ fileName ) { if ( ! $ path ) { $ path = __DIR__ ; } if ( self :: isFolder ( $ path ) ) { $ dir = new \ RecursiveDirectoryIterator ( $ path ) ; foreach ( new \ RecursiveIteratorIterator ( $ dir ) as $ filePath ) { if ( $ fileName == basename ( $ filePath ) ) { return $ filePath ; } } } } return false ; }
Find file with a given name inside a given directory.
@param string name of the file to find
@param string directory to scan
@example find('log.txt', 'folder')
@return string full path to file
Find file with a given name inside a given directory .