Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os,time,shutil
- counter = 1
- filename = "webcam.jpg"
- dir_of_testfile = "/home/pi/webcam2/"
- destination = "/home/pi/webcam2/backup"
- os.chdir(dir_of_testfile)
- while True:
- if not os.path.exists(filename):
- continue
- newfile = "%s_%s.jpg" %(filename[:-4] , str(counter).zfill(2) ) #eg test_01.txt,test_02.txt
- shutil.move(filename, os.path.join(destination,newfile) )
- counter += 1 #increment counter
- time.sleep(60) #sleep 1 min
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement