Keep track of path and write files