fswebcam
fswebcam copied to clipboard
Add '-m'/'--mkdir' options to make file path like mkdir -p
Hi there!
I've added an option and associated code for having fswebcam check and create the components of the path it's writing files to. This is useful for when writing e.g. time lapses into date-named directories, and a new day starts while fswebcam is running.
BTW, I tested this and it worked on new invocation but not when left running and moving into a new day. I'll trace this down.
Hi there! I've tested this and it's now working :-)
I found a minor annoyance where it would say it was creating a directory with the same name as the filename (although, for reasons I don't entirely understand, it didn't actually create that directory). I fixed that by only looking at the 'directories' part of the path, ignoring the filename at the end. I've tested this and it works.
Hi Paul,
You could do this now with the --exec command, for example:
$ fswebcam --loop 60 --exec "mkdir -p /timelapse/%Y-%m-%d" --png 6 /timelapse/%Y-%m-%d/%H-%M-%S.png
I do like the idea of a flag for it though, seems tidier. I'll try and get a look at it soon.
On 28/10/16 22:17, Philip Heron wrote:
Hi Paul,
You could do this now with the --exec command, for example:
|$ fswebcam --loop 60 --exec "mkdir -p /timelapse/%Y-%m-%d" --png 6 /timelapse/%Y-%m-%d/%H-%M-%S.png|
I do like the idea of a flag for it though, seems tidier. I'll try and get a look at it soon.
Hey, Phil! Sorry, I was going to write to you this weekend and see if you'd seen the merge request :-)
I did think about that but I think it's so much simpler to have a single option to do that, especially as people may already need the exec call for something else.
Anyway, thanks for getting back to me. Hope this helps!
Have fun,
Paul
Just updated to the current version.