I would also pass the directory in as a parameter, it again makes the function more moveable and re-usable.