create_symlinks: extract common code to function