Don't join and split each time

`path.basename(f.join("/")).split("/")` is called on _every iteration_ of checking the patterns and if a `pattern.length = 1`. Instead, just perform the rearrangement once and keep it handy.