To add a simple “hi” prefix to all the PDF files in the folder, I use this batch file:
FOR %%F IN (*.pdf) DO (RENAME "%%F" "hello%%F")
I saved this in the file "rename.bat" and placed it in the folder in which I need the files that need to be renamed. Then I just double click on "rename.bat".
This almost works, but the first file gets the prefix added twice.
Let's say in the folder that I have: A.pdf, B.pdf, C.pdf, they are converted to:
- hellohelloA.pdf
- helloB.pdf
- helloC.pdf,
Do you know what's wrong in a batch file?
I noticed that this always happens when files are more than one . It works fine when there is only one file in the folder, but this is not very useful :-).
source share