make sure to append to directory name and not to filename.