My family has recordings of the children's performances in school and extracurricular activities saved over the years as primarily .avi
and .mp4
files. I have been asked to take all these files (there are well over a hundred of them) and relabel any video that starts with the word The
or A
and move it to the end.
For example, a video titled The Kids Performances (2020).mp4
would be changed to Kids Performances, The (2020).mp4
. I have no idea why they want to keep the words The
and 'A' in the titles at all, but they do.
I’m using Windows and found a relatively simple method on a board on this site that I can use to get rid of the The
at the beginning of the titles, but I cannot figure out a way to move it to the back of the title before the year recorded which is always listed as (year).
Here’s what I am talking about:
for %%i in ("*.mp4") do (set fname=%%i) & call :rename
goto :eof
:rename
::Cuts off 1st four chars, then appends prefix
ren "%fname%" "%fname:~4%"
goto :eof
This takes care of removing the first 4 characters from the titles in a batch format, but I am having trouble moving those first 4 characters to the end of the title before the year. I have pleaded with my family members to just leave these words out of the title all together, but I cannot convince them.
I have Python installed on the PC as well if that would provide an easier method to achieve this goal. Thank you in advance to anyone able to assist!
(YYYY)
at the end of the name?call
andgoto :EOF
(preventing the need for delayed expansion regardless of what you do in the labeled block).