@echo off & setlocal
cd X:\video\path
for /f "delims=" %%i in ('dir /b /a-d *.mp4') do (
set "fnameo=%%~ni"
set "fnamee=%%~xi"
set "Height="
for /f "delims=" %%j in ('mediainfo "--Inform=Video;%%Height%%" "%%~i"') do set "Height=%%j"
setlocal enabledelayedexpansion
call set "selftest=%%fnameo:[x264 !Height!p]=%%"
if "!selftest!" equ "!fnameo!" if not exist "!fnameo! [x264 !Height!p]!fnamee!" (
echo rename "!fnameo!!fnamee!" "!fnameo! [x264 !Height!p]!fnamee!"
)
endlocal
)
This is the script taken from
StackOverflow. It requires you also to download a tool:
mediainfo (command-line version, direct link to the download).
After downloading and extracting the archive, you should either copy it into a folder that is part of your system's PATH variable or add the folder you extracted mediainfo into to your system's PATH variable, similar to the following example:
SET PATH=%PATH%;X:\name\of\your\extract\folder The script is supposed to take any file from the folder you configure:
cd X:\video\pathand add the resolution of the video/movie file to it's name. That is the only thing the script does in it's current state.
As it is, it only checks for movie files with the extension .mp4 and it won't rename files just yet. It will show you the example of the renaming it is intending to do. So you can still adjust the renaming schema to your liking, without messing up the names the video/movie files currently have.
When you have set the name schema you like, remove the text '
echo' from the line:
echo rename "!fnameo!!fnamee!" "!fnameo! [x264 !Height!p]!fnamee!"and rerun the script.
Doing the renaming by script will make it a job that is done quickly and consistent, without too much user intervention (once it is setup to your liking) now or in the future. From your description I gathered that you need to do this for a lot of files, so scripting is in such cases preferable.
MediaInfo (main website) looks to be a pretty extensive tool for retrieving lots of the data you want to incorporate into the file names. Please investigate further for incorporating more of those features into the script and the files in your forum should soon be properly renamed.
Hope it helps.