Adding prefix to all filenames in folder
Adding a prefix to all filenames in a directory by FOR command under Windows. Only to filenames, not to folder names as well. Batch file contents:
FOR /F "TOKENS=*" %%A IN ('DIR /B /A-D') DO REN "%%A" "PREFIX%%A"
Note: enter your prefix instead of PREFIX.
Adding prefix only to filenames of specific type
Prefixing only .htm and .jpg files for example:
FOR /F "TOKENS=*" %%A IN ('DIR /B /A-D *.htm *.jpg') DO REN "%%A" "PREFIX%%A"
Note: enter your prefix instead of PREFIX.
Operating systems
- Windows: tested on Windows 7