My camera is creating files like 01042007011.jpg (DAYMONTHYEARNUMBER.EXT).
I would like to create a batch file that rename them to YEARMONTHDAY_NUMBER.EXT, 20070401_011.jpg in my exemple.
As I don't have delimiters, except for the extension, i don't really know how to split the different elements of the filename. I've tried something like this:
for /F "tokens=*" %%A in ('dir *.jpg *.mp4 /B') do (
for /F "delims=. tokens=1" %%G in ("%%A") do (
call :_rename %%G
This will return:
011 -> working
2007011 -> how to remove the 011 at the end ?
The tilde with the dash (~-) permits me to return only the last 3 characters of my strings. So its working fine to get the filenumber.
I tried to do it with ~+, but it then remove an amount of characters at the beginning. So it only returns the end of the string in both case. I haven't found a way to have only the day, month and year.
Thanks for your help.