Scheduling such that pictures get deleted from the rpi - Raspberry Pi Forums
hey guys,
new rpi , wondering if there's way schedule such whenever picture taken camera module, gets saved folder , when folder exceeds limit of 10 images, 5 oldest images deleted itself.
please guide me how that?
appreciated.

new rpi , wondering if there's way schedule such whenever picture taken camera module, gets saved folder , when folder exceeds limit of 10 images, 5 oldest images deleted itself.
please guide me how that?
appreciated.

ok! so... dont know camera api can detecting the 5 oldest photos 
ok every time take photo use (make shure py file located in same folder or place full path of line 3 *): let me know if there problem cuz didnt compiled it...

ok every time take photo use (make shure py file located in same folder or place full path of line 3 *):
code: select all
import glob import os photosarray = glob.glob("*.png")# gets photos in imgs fold..* print photosarray if len(photosarray)>=9:#10 photos created? print "yay lets start bubble sorting!" #sort alist = photosarray passnum in range(len(alist)-1,0,-1): in range(passnum): if os.path.getmtime(alist[i])>os.path.getmtime(alist[i+1]): temp = alist[i] alist[i] = alist[i+1] alist[i+1] = temp print photosarray = 1 while(a<5): os.remove(photosarray[a]) photosarray.remove(photosarray[a]) a=a+1 print photosarray def bubblesort(alist): passnum in range(len(alist)-1,0,-1): in range(passnum): if os.path.getmtime(alist[i])>os.path.getmtime(alist[i+1]): temp = alist[i] alist[i] = alist[i+1] alist[i+1] = temp
raspberrypi
Comments
Post a Comment