6

I have multiple files in a folder all the different name in windows with common suffix say _(new). Example:

File Name_(new).mp4

How do I rename all the files by removing the suffix _(new) but not changing the name of the files?

0

Running the REN or RENAME command in Command Prompt should work for you:

Assuming the type is always .mp4:

RENAME *_(new).mp4 *.mp4

Otherwise, the following should work:

RENAME *_(new).* *.*

First, you want to CD into the folder it's in.

If you start your computer normally, CMD should put you in your user folder, e.g:

C:\Users\Macraze

or it might put you in the system32 folder:

C:\windows\system32

Either way, you can CD into the folder you want by typing something like:

C:\Users\Macraze> CD Downloads
//whoops, wrong folder, you can just 'CD ../' out
C:\Users\Macraze\Downloads> CD ../
C:\Users\Macraze> CD Desktop
C:\Users\Macraze\Desktop> CD Misc
C:\Users\Macraze\Desktop\Misc> RENAME *_(new).* *.*

When you run this command, the asterisk * is called a wildcard, meaning all content that matches the rule of having _(new). in between the filename / extension will get renamed.

|improve this answer|||||
  • how do I specify the folder? Would the prompt rename all files in my computer? – Maroof Mandal Aug 24 '15 at 14:19
  • No, CMD will start in a specific folder and you can CD into a specific folder (and CD ../ out), or drag the folder icon into CMD after CD to specify the folder – Quill Aug 24 '15 at 21:21
  • 4
    It makes no sense for this answer to be accepted. The proposed command has absolutely no effect, and it certainly does not answer the question. – dbenham Sep 2 '16 at 14:23
  • 1
    @dbenham, then add an answer. Vandalising the post is immature and childish. – Quill Sep 2 '16 at 16:37
  • 3
    Here, this disgusting monstrosity will work: cmd /V:ON /s /c "set "suffix=_(new)" && set "ext=mp4" && for /F "delims=" %F in ('dir /B "*!suffix!.!ext!"') do @(set "_tmp=%F" && cmd /s /c "rename "%_tmp%" "%_tmp:!suffix!=%"")" Just change the "suffix=_(new)" and "ext=mp4" parts to whatever you need. If you want to see it without it actually doing it just add an echo statement before the rename It's all inclusive and turns on delayed expansion with the /v:on which contributes, a lot, to why it's so ugly. If put in a batch file make sure to use %%F instead of %F. – Brent Rittenhouse Nov 13 '18 at 3:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.