V
V
Vladimir2021-06-06 06:00:18
cmd/bat
Vladimir, 2021-06-06 06:00:18

How to bulk rename PDF files by removing numbers (numbering) before the first letter?

Tell me, please, where can I find information on this issue:
"How to massively rename PDF files by deleting numbers (numbering) to the first letter?"?
I searched a lot of sites, but I did not find the answer.

ps I don't know how difficult the question is, I put it "simple". It is desirable to need a batch file, and not third-party software.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2021-06-08
@Equess

Where can I find information on this issue

First of all, in the built-in help for internal commands:
set /?
if /?

You can also try following the links from the CMD/BAT topic: Collection of Links …
Sample code:
for %%F in (*.pdf) do (
  set "old_name=%%~nF"
  set "new_name=%%~nF"
  call :SUB
)
exit /b


:SUB
set "ch=%new_name:~0,1%"
if "%ch%" geq "0" if "%ch%" leq "9" (
  set "new_name=%new_name:~1%"
  goto SUB
)
if not "%new_name%" == "%old_name%"  ren "%old_name%.pdf" "%new_name%.*"
exit /b

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question