replacing ~ in filenames as well