Page 1 of 1

security camera data backup

Posted: Fri Jul 14, 2017 3:24 pm
by marmaladefly
I have been using my raspberrypi & camera as a security camera monitoring front drive.
For storage I use a large capacity USB memory stick.
After several days I receive an error as the stick is full and I have to delete files to make room.
So one question is - can i code for this? detect memory is nearly full and then have old files deleted automatically using code so that program doesn't come to a end?
I have a couple of external hard drives that I could use for storage instead.
Rather than connect a hard drive and have that running all day everyday I like the idea of using code to detect when my USB stick storage is full (about four days) then power up the hard drive using remote controlled power sockets; perform USB stick backup to hard drive, then wipe USB stick files, and power down hard drive.
unfortunately by the time I have worked out how to do this my Pi may be obsolete (slow learner)
or is there an easier way?

Re: security camera data backup

Posted: Fri Jul 14, 2017 5:21 pm
by pageauc
Could create a simple script to delete files older than a specified number of days. Put this in a crontab to run once a day or as often as needed. Below is just an example so edit find parameters to suit your needs.

Code: Select all

find /home/pi/my_dir -mtime +10 -type f -delete
  • ./my_dir your directory (replace with your own)
  • -mtime +10 older than 10 days
  • -type f only files
  • -delete
Test before using. Remove - delete parameter to test your find filter before executing the whole command

Re: security camera data backup

Posted: Fri Jul 14, 2017 6:25 pm
by marmaladefly
Thank you very much, that should work fine.
I also had a look at one of your utube videos too and motion detection may be of even more use as I wouldn't need to record hours of nothing happening.
Thanks again !

Re: security camera data backup

Posted: Sun Jul 16, 2017 8:06 pm
by pageauc
Recently replaced motion detection with motion tracking. Motion detection can trigger false positives from moving bushes or similar. Motion tracking on the other hand requires a minimum size moving object that travels a certain distance. This better ensures motion was real although objects moving straight at the camera might not be triggered by tracking since from the camera's perspective it is not moving sideways or up/down. In the real world most objects move into frame from one side and progress across view for a while. Anyway try out pi-timolo It is mainly geared to headless remote situations and can upload images to a users google drive. I also mention other security camera options so take a look at those links. I like pi-timolo since it gives myself and other users the option of changing the code if they have some background in programming.
Claude ....