The way `path` is stored in another variable and then overwritten in the loop looks pretty weird. Please avoid that by just using a different variable inside the loop to build the full path without changing the surrounding loop variable `path`.