join top_dir, relative_dir and return value of the function filename.replace called with 2 arguments: base_name and name,
new_path = path . join ( top_dir , relative_dir , filename . replace ( base_name , name ) )