private static function FilterByType($dir, $file, FileSystemEntryType $type = null)
    {
        if ($file == '.' || $file == '..')
            return false;
        
        if (!$type)
            return true;
        
        $path = Path::Combine($dir, $file);
        
        
        switch ($type)
        {
            case FileSystemEntryType::File():
                return is_file($path);
                
            case FileSystemEntryType::Folder():
                return is_dir($path);
                
            case FileSystemEntryType::Link():
                return is_link($path);
        }
        return false;
    }