How to get object from path name?

Thanks for the solution!
I managed to make a small improvement to it.

The issue:
If you have in the same folder a file named “Strawberry” and a file named “StrawberryYummy” both of these will pass through the filter part and undesired results may happen after.
There may be even bigger weird stuff happening if these files have a folder above them called “Strawberry” but i didn’t test this.
To remove this issue, it seems to be enough to just add ‘/’ at the start of the substring, and ‘.’ at the end of the substring.