I have tried all of the mentioned answers using contains, indexof, substring but nothing was working for me.
In case you have a similar issue I advise trying a wildcard char (*) like this:
$filter=FileRef eq '*sites/my folder/subfolder*'
This was the only solution that worked for me and I found it in another thread after some time: original answer