Replace the pfunction files in dir.