Question

I am trying to check a batch of file names and change the name the files look like the following

er-1.gif

I need to check the numbers after the dash and then look through an array to find what number i need to replace er with.

How can i create a batch file to-do this?

I have Windows & Mac available to work on.

Was it helpful?

Solution

You can parse the filename using regex. This will return you the integer you're interested in.

Then look up the corresponding name in your array and write to a new file with the new name

If you know that the number after the '-' is the only number in the whole string you can simply use "\d" as your regex expression.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top