I have a large amount of JPEGs inside subfolders that I need to rename to their current name with an extra 1 at the end.

For example:

G:\FILENAME\Subfolder1\subfolder2\JPEGNAME.JPG

Want to rename to

G:\FILENAME\Subfolder1\subfolder2\JPEGNAME1.JPG

I have over 900 files in this format that I need to rename.

Any help?

有帮助吗?

解决方案

edit I added /r as I see you have a tree of files to modify. Type this command in the main holding folder of the JPG files.

Here's a cmd prompt command. Delete the echo if you like what you see on the console.

for /r %a in (*.jpg) do echo rename "%a" "%~na1%~xa"

其他提示

There may not be a need for anything more than a simple REN command. See How does the Windows RENAME command interpret wildcards?.

As long as none of your file names have multiple dots in the name, then the following should work for the current directory. Just make sure there are at least as many ? as the longest name.

ren *.jpg ??????????????????????????????????????1.jpg

Or to process the entire directory tree

for /r %F in (.) do @ren "%F\*.jpg" ??????????????????????????????????????1.jpg

Or you can iterate each file with a FOR or FOR /R loop and rename them one at a time as foxidrive does in his answer.

using renamer:

$ renamer --find '/(.*)\.JPG/' --replace '$11.JPG' *

to operate recursively, change the * at the end of of the command to **.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top