Batch DOS - Replace "part of" filenames
Posted: 29 Nov 2019 10:03
Hi guys, sorry me if there is something similar, but i cant find something to help me.
i have some file named:
11223344_0123_.pdf
11223355_1234_.pdf
(or if can be more simply i can generate name as 11223344_0123.pdf, whitout last underscore)
i need rename all files without chars beetween underscore, and obtain:
11223344.pdf
11223355.pdf
i have write this
but i cant find something to say "from first _ to last _
similar
but in this way no work
can you help me? really thanks
i have some file named:
11223344_0123_.pdf
11223355_1234_.pdf
(or if can be more simply i can generate name as 11223344_0123.pdf, whitout last underscore)
i need rename all files without chars beetween underscore, and obtain:
11223344.pdf
11223355.pdf
i have write this
Code: Select all
setlocal enabledelayedexpansion
for %%a in (*_*) do (
set file=%%a
ren "!file!" "!file:_=!"
)
similar
Code: Select all
ren "!file!" "!file:_*_=!"
can you help me? really thanks