Advertisement
Guest User

copy

a guest
Jul 22nd, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. import os,time,shutil
  2. counter = 1
  3. filename = "webcam.jpg"
  4. dir_of_testfile = "/home/pi/webcam2/"
  5. destination = "/home/pi/webcam2/backup"
  6. os.chdir(dir_of_testfile)
  7. while True:
  8.   if not os.path.exists(filename):
  9.     continue
  10.   newfile = "%s_%s.jpg" %(filename[:-4] , str(counter).zfill(2) ) #eg test_01.txt,test_02.txt
  11.   shutil.move(filename, os.path.join(destination,newfile) )
  12.   counter += 1 #increment counter
  13.   time.sleep(60) #sleep 1 min
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement