Rename multiple files without parentheses / delete parentheses

I want to rename a large number of files in ascending order of numbers, starting from anywhere. But when I rename multiple files, it leaves me with parentheses. for example, I rename files to abc_.jpeg, this leads to abc_ (1) .jpeg, abc_ (2) .jpeg, etc.

I tried using the command line to rename

ren abc_(*).jpeg abc_*.jpeg
does not work. probably due to brackets

ren abc_"("*")".jpeg abc_*.jpeg
renames files, but results in the same file name as before. I just want to somehow remove the parentheses.

+6
source share
2 answers

To remove the brackets, you will need to manipulate the string a bit. I wrote a batch file for this (save as .bat )

 cd C:\folder setlocal enabledelayedexpansion for %%a in (abc_*.jpeg) do ( set f=%%a set f=!f:^(=! set f=!f:^)=! ren "%%a" "!f!" ) 

I do not think that you can easily do this in one line from the command line, although it is possible, but it will be ugly. If you can help him use this batch file to remove the brackets.

+11
source

In the Explorer window, select all files, right-click and select Rename. Windows will choose the start number as the number between parentheses, so write the file using a number that is 1 digit more than the number of digits required.

Example : We need the template "test_xxx". Using File Explorer, rename the files to "tes (1000)". Now your files will be called ["tes (1000)", "tes (1001)", "tes (1002)", etc.]. Hold SHIFT and right-click in an open area of ​​Explorer, then select "Open Command Window Here." Run the following command:

 ren *.* test_???.* 

This will rename all files to the appropriate format ["test_000", "test_001", "test_002", etc.].

+1
source

All Articles