In [29]:
import os
In [30]:
import os.path
In [31]:
import socket
In [32]:
serverSend = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
In [33]:
serverSend.bind(('fendesk', 22))
In [34]:
import spur
In [35]:
shell = spur.LocalShell()
In [36]:
defDir = ('/home/wcmckee/Desktop/pybackupz')
In [37]:
import pyflakes
In [ ]:
socket.
In [11]:
os.chdir(defDir)
In [16]:
import spur
shell = spur.LocalShell()
result = shell.run(["echo", "-n", "hello"])
print result.output # prints hello
In [17]:
desktopz = spur.SshShell(hostname="fendesk", username="will", password="comp123")
with desktopz:
result = desktopz.run(['echo', '-n', 'hello'])
print result.output
In [5]:
newpath = ('sftp://192.168.1.11/home/shared/webcam3')
In [6]:
os.chdir(newpath)
In [314]:
filDir = ('/var/motion')
copyDir = ('/home/wcmckee/Documents')
In [315]:
os.chdir(filDir)
In [334]:
In [335]:
class Backup(object):
def findfiles(self, filestring):
filecur = os.listdir(os.curdir)
for filename in filecur:
if filestring in filename:
yield filename
In [336]:
app = Backup()
In [337]:
app.findfiles('mp')
Out[337]:
In [366]:
year = ('2014')
month = ('01')
day = ('23')
hour = ('07')
mint = ('30')
secnd = ('20')
In [367]:
comboData = (year + month + day + hour + mint + secnd)
In [368]:
print comboData
In [369]:
for aviz in app.findfiles(comboData):
print aviz
In [370]:
print aviz
In [371]:
fixDir = filDir + '/' + aviz
In [372]:
import paramiko
In [373]:
sshNow = paramiko.SSHClient()
In [374]:
os.chdir('/home/wcmckee/Documents')
In [375]:
password = open('ps.txt', 'r')
In [376]:
thePass = password.readline()
In [393]:
sshNow.connect('192.168.1.4', username='wcmckee',password = thePass)
In [394]:
import shutil
In [395]:
copyMovz = shutil.copy2(fixDir, copyDir)
In [396]:
for fileza in app.findfiles('last'):
print fileza
In [397]:
import time
In [398]:
from PIL import Image
from PIL import ImageDraw
from PIL import ImageChops
import random
import os
from PIL import ImageEnhance
from ftplib import FTP
In [399]:
ftp = FTP('ftp.freshfigure.com')
ftp.login('ipython', 'Testing123now#')
Out[399]:
In [400]:
def upload(ftp, file):
ext = os.path.splitext(file)[1]
if ext in (".txt", ".htm", ".html", ".jpg", ".mpg"):
ftp.storlines("STOR " + file, open(file))
In [401]:
upload(ftp, aviz)
In [387]:
import shutil
import time
import PIL
In [388]:
copyFilez = shutil.copy2('/home/will/Documents/photoz/lastsnap.jpg', '/home/will/Downloads/photoz/lastsnap.jpg')
In [39]:
'''
for x in range(0, 3):
time.sleep(20)
copyFilez
print('done!')
'''
Out[39]:
In [40]:
savImz = PIL.Image.open(fileza)
In [41]:
savImz.show()
In [41]:
In [ ]: