Remove "_to" from file name
Moderator: DosItHelp
Remove "_to" from file name
Hi i have this file 2089_24078_to.pdf i need to remove "_to"from name result to be reached 2089_24078.pdf
Re: Remove "_to" from file name
Assuming there are always two underscores in your file name ...
Steffen
Code: Select all
@echo off
for %%i in (*_to.pdf) do for /f "tokens=1,2 delims=_" %%j in ("%%~ni") do ren "%%~fi" "%%j_%%k%%~xi"
Steffen
Re: Remove "_to" from file name
…or for every pdf file in "D:\Documents" whose name ends with _to
From the Command prompt:
From a batch file:
From the Command prompt:
Code: Select all
For %A In ("D:\Documents\*_to.pdf") Do @Set "_=%~nA"&Call Ren "%A" "%_:~,-3%%~xA"
From a batch file:
Code: Select all
@For %%A In ("D:\Documents\*_to.pdf") Do @Set "_=%%~nA"&Call Ren "%%A" "%%_:~,-3%%%%~xA"