public static function find($filename)
    {
        // Split to folders and the actual filename, and traverse the structure.
        $parts = array_filter(preg_split("#[/\\\\]+#", $filename));
        $parentID = 0;
        /** @var File $item */
        $item = null;
        foreach ($parts as $part) {
            $item = File::get()->filter(array(
                'Name' => $part,
                'ParentID' => $parentID
            ))->first();
            if (!$item) {
                break;
            }
            $parentID = $item->ID;
        }

        return $item;
    }
public static function find($filename)
    {
        // Split to folders and the actual filename, and traverse the structure.
        $parts = array_filter(preg_split("#[/\\\\]+#", $filename));
        $parentID = 0;
        /** @var File $item */
        $item = null;
        foreach ($parts as $part) {
            $item = File::get()->filter(array(
                'Name' => $part,
                'ParentID' => $parentID
            ))->first();
            if (!$item) {
                break;
            }
            $parentID = $item->ID;
        }

        return $item;
    }
public static function find ( $ filename ) { // Split to folders and the actual filename, and traverse the structure. $ parts = array_filter ( preg_split ( "#[/\\\\]+#" , $ filename ) ) ; $ parentID = 0 ; /** @var File $item */ $ item = null ; foreach ( $ parts as $ part ) { $ item = File :: get ( ) -> filter ( array ( 'Name' => $ part , 'ParentID' => $ parentID ) ) -> first ( ) ; if ( ! $ item ) { break ; } $ parentID = $ item -> ID ; } return $ item ; }
Find a File object by the given filename.

@param string $filename Filename to search for, including any custom parent directories.
@return File
Find a File object by the given filename .