Batch file to rename files by adding different suffix to each file -
i want create batch file rename files folder adding different suffix each file example this,
- file1.mp4
- file2.mp4
- file3.mkv
- file4.mkv
to these
- file1 sandwich.mp4
- file2 hot dog.mp4
- file3 apple.mkv
- file4 toast.mkv
i hoping put these words in batch file putting in separate txt file more preferable
note: put same number of suffix in txt file there files on folder.
i want faster way of adding these suffix doing 1 one manually
i have limited knowledge these codes
the program below rename files in order given dir
command suffixes given in suffixes.txt
file. if there more files suffixes, last suffix used several times.
@echo off setlocal enabledelayedexpansion < suffixes.txt ( /f "delims=" %%a in ('dir /b folder\*.*') ( set /p suffix= echo ren "%%~fa" "%%~na !suffix!%%~xa" ) )
for example:
c:\> type suffixes.txt sandwich hot dog apple toast c:\> test.bat ren "file1.mp4" "file1 sandwich.mp4" ren "file2.mp4" "file2 hot dog.mp4" ren "file3.mkv" "file3 apple.mkv" ren "file4.mkv" "file4 toast.mkv"
if ren
commands looks correct, remove echo
part in last command in order execute ren
commands.
Comments
Post a Comment