Make the files mapper recursively

This resolves issues on windows, when a parent folder had an index in the past
but the conflicting folder has been removed. Previous to this patch this would
cause a mess on the MappedStorage, since new children are not added to the
correct folder anymore.

Now the method is build recursively, so it correctly uses the parent physical
path instead of trying to recalculate it.

Fix #11103

@th3fallen @DeepDiver1975 @rperezb @icewind1991 @jnfrmarks
So in the end this replaces one or more dots at the end of the `$text` string -> same behaviour as `rtrim($text, '.')`