Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No explanation of exclude filter options #90

Open
joepitt91 opened this issue Jul 20, 2022 · 6 comments
Open

No explanation of exclude filter options #90

joepitt91 opened this issue Jul 20, 2022 · 6 comments

Comments

@joepitt91
Copy link

I like the idea of exclude filters, however, I don't seem to be able to get them working consistently and also don't seem to be able to find any documentation about how to use them.

Adding some examples to README.md and the settings page would be really helpful.

filename seems to work as expected:

  • filename = ignore.txt - excludes ignore.txt
  • filename GLOB .git* - excludes .gitignore files etc.

size works as expected:

  • size = 0 - excludes empty files

I cannot get path to work no matter how I try, I'm trying to exclude entire directories (recursively) e.g. my development Projects folder:

  • path = /username/files/Projects - does nothing
  • path = Projects - does nothing
  • path GLOB */Projects - does nothing
  • `path GLOB */Projects/ - does nothing

I've not tried the RegEx module, as there is no indication of accepted format, i.e. are escaping /s needed, etc.

@joepitt91
Copy link
Author

Continued trial and error has found that this is how to use path, documentation would still be really good.

path GLOB **/Projects/**

I now have a manageable list of duplicates to work through and resolve.

@leonardodalinky
Copy link

Same. Need details of the ignored files filter, especially of the regex.

@leonardodalinky
Copy link

leonardodalinky commented Aug 2, 2022

ok guys i find out the logics in lib/Service/FilterService.php:

private function testStringCondition(string $operator, string $a, string $b) : bool
{
    switch ($operator) {
        case 'GLOB':
            $result = fnmatch($a, $b);
            break;
        case 'REGEX':
            $result = preg_match($a, $b);
            $result = ($result === 0 || $result === false);
            break;
        default:
            $result = $a === $b;
    }
    return $result;
}

Only builtin PHP functions are used here.

FYI, fnmatch and preg_match.

@Quix0r
Copy link

Quix0r commented Sep 12, 2022

I have choosen GLOB and entered */My Games/*, still a lot of entries like this show up:

/Documents/My Games/DemolitionCompany/shader_cache/99b66379_30b1b790_96161108_bfcd5cb9_3_3_1024_512_1_fs.xml

I want to exclude save-games as they may have a lot duplicate files.

@joepitt91
Copy link
Author

@Quix0r, change your GLOB to:

**/My Games/**

* matches a single directory
** matches multiple directories

Hope that helps

@Quix0r
Copy link

Quix0r commented Sep 25, 2022

@joepitt91 Yes, it did. Thank you (and now I remember it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants