Hi folks,
You might remember me from a few months ago. I'm working on a long-term time lapse for a construction project which involves a couple gopros taking pictures every 60 seconds. I posted a question and received an answer about a batch script to delete files based on the (24h) date/time modified in order to delete photos taken at night. I ended up using this script from Salmon Trout which worked perfectly.
@echo off
> "%temp%\fhour.vbs" echo Set fso = CreateObject("Scripting.FileSystemObject")
>> "%temp%\fhour.vbs" echo Set f = fso.GetFile(trim(wscript.arguments(0)))
>> "%temp%\fhour.vbs" echo wscript.echo Hour (f.DateLastModified)
for %%A in ("H:\*.*") do (
for /f "delims=" %%B in ('cscript /nologo "%temp%\fhour.vbs" "%%~fA"') do (
set "action="
if %%B lss 8 set action=Delete
if %%B geq 18 set action=Delete
if /i not "%%~fA"=="%~f0" if defined action echo deleting "%%~fA" & del "%%~fA"
)
)
pause
This script leaves me with only photos taken during work hours. The next problem I've encountered is that the Gopro studio software creates different video segments based on the chronological order of the file names. Cutting out 60% of the photos causes the software to create a large number of video segments that tend to have no rhyme or reason to their length or order. I solved this problem with another batch script that renames files to a certain naming convention based on the order they appear in the folder:
@echo off
pushd %~dp0
setlocal EnableDelayedExpansion
set filename=asdf
set Num=1
for /r %%i in (*.jpg) do (
ren "%%i" "%filename%.!Num!.jpg"
set /a Num+=1
)
I've been adding captions (dates, descriptions, etc) to the video within the gopro software. I've been doing this manually and I'm ok with that (some people out there are using python scripts to pull the metadata from photos and automate their captioning that way but I'm not prepared to go that deep quite yet). Until now I've been able to simply watch the video, observe when its getting dark, and add captions based on what I see in the video. As the days get longer I'm finding it increasingly difficult to pick out the transitions from one day to the next and this is only going to get more difficult as the days get longer.
Here is my question:
Is there some way to modify the second script I posted so that it will rename the files based on the date/time modified rather than the order in which the files appear in the folder? Right now the script is renaming the files to "asdf.zzz.jpg" where zzz is just an arbitrary sequential number (num+1). What I'd really like is for it to rename the file to something along the lines of "asdf.wwww.xx.yy.zzz.jpg" where wwww is the year (2018), xx is the month (02), yy is the day (22), and zzz is either the time in 24h format (0800) or an arbitrary sequential number starting at 1 for the day (num+1). I believe either will work.
If I import a large number of photos named with this naming convention the software should automatically create a single video segment per day which will make my captioning and data management infinitely easier.
Any help is greatly appreciated.
Jeremy