private function allMediaFiles(string $media_folder, string $subfolders): array
    {
        $query = DB::table('media_file')
            ->join('gedcom_setting', 'gedcom_id', '=', 'm_file')
            ->where('setting_name', '=', 'MEDIA_DIRECTORY')
            ->where('multimedia_file_refn', 'LIKE', '%/%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'http://%')
            ->where('multimedia_file_refn', 'NOT LIKE', 'https://%')
            ->where(DB::raw('setting_value || multimedia_file_refn'), 'LIKE', $media_folder . '%')
            ->select(DB::raw('setting_value || multimedia_file_refn AS path'))
            ->orderBy(DB::raw('setting_value || multimedia_file_refn'));

        if ($subfolders === 'exclude') {
            $query->where(DB::raw('setting_value || multimedia_file_refn'), 'NOT LIKE', $media_folder . '%/%');
        }

        return $query->pluck('path')->all();
    }