@echo off
echo Before:
for %%A in (*.jpg) do (
for /f "tokens=1-2 delims=" %%i in ('"forfiles /m "%%A" /c "cmd /c echo @fdate @ftime" "') do echo %%i %%j %%A
)
echo Changing dates...
for %%A in (*.jpg) do (
echo Redating %%A
copy /b "%%A"+,, > nul
ping -n 2 127.0.0.1>nul
)
echo After:
for %%A in (*.jpg) do (
for /f "tokens=1-2 delims=" %%i in ('"forfiles /m "%%A" /c "cmd /c echo @fdate @ftime" "') do echo %%i %%j %%A
)
Output:
Before:
22/12/2016 21:52:17 img01.jpg
15/04/2017 19:25:39 img02.jpg
26/12/2010 11:00:45 img03.jpg
03/02/2018 20:48:00 img04.jpg
15/07/2018 20:01:14 img05.jpg
29/03/2012 19:28:54 img06.JPG
04/10/2003 16:47:54 img07.jpg
04/08/2006 17:27:25 img08.jpg
Changing dates...
Redating img01.jpg
Redating img02.jpg
Redating img03.jpg
Redating img04.jpg
Redating img05.jpg
Redating img06.JPG
Redating img07.jpg
Redating img08.jpg
After:
14/10/2018 09:25:48 img01.jpg
14/10/2018 09:25:49 img02.jpg
14/10/2018 09:25:50 img03.jpg
14/10/2018 09:25:51 img04.jpg
14/10/2018 09:25:53 img05.jpg
14/10/2018 09:25:54 img06.JPG
14/10/2018 09:25:55 img07.jpg
14/10/2018 09:25:56 img08.jpg
Please note that https://superuser.com is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?.
– DavidPostill – 2018-10-14T08:47:35.497luckily I managed to get a great answer that will probably be useful to others before you put it on hold ... this kind of moderation is bs – kofifus – 2018-10-15T01:04:31.047
Hey, folks, I'll delete my answer if you really truly feel the questioner does not deserve it, but if he/she has any sense they will have copied it by now. – Michael Harvey – 2018-10-16T16:49:36.930
great answer, please keep it – kofifus – 2018-10-16T20:59:31.140
The essence of it is that
copy /b filename+,,
redates the file to the current time. – Michael Harvey – 2018-10-16T21:10:10.847