get_replace_dir_fun function

Get a function to replace the directory of a filename