Renaming a group of files, at the same time, using a regex to concatenate a number before their extension - Python or Batch Script
问题 I want to rename each file that ends in .log, but I have similar files like: x.log x01.log y.log y01.log .... I want to rename every file, at a time, with that extension (.*) but without any number, i.e., I want to rename x.log to xN.log, y.log to yNlog, z.log to zN.log, in which N is the number I want to concatenate. Is this possible in a Windows batch script using a regex or even Python? Anything will do, as long as I can give the parameter N. 回答1: SET ext=.log SET num=%1 FOR %%f IN (*%ext%