def renameFileAppendTo(self, path_src, old_name, app_str): p = Path('%s/%s' % (path_src, old_name)) new_name = '%s_%s%s' % (p.stem, app_str, p.suffix) p.rename(Path(p.parent, new_name)) return new_name