You are on page 1of 1

#!

/usr/bin/python
import os
import time
import subprocess
from glob import glob
basedir = os.getenv("HOME")
os.chdir(basedir)
print "Searching for Dropbox folder..."
output = subprocess.check_output("find . -name DATA -type d", shell=True)
output = output.split('\n')
date = time.strftime("%m%d%y")
filename = "BILDdatabase_" + date + ".fmp12"
for line in output:
if "Dropbox" in line:
print "Dropbox folder has been found!"
line = line[1:]
origFile = basedir + line + "/Database/BILDdatabase927.fmp12"
backupDir = line + "/Database/Backups/"
backupFile = basedir + backupDir + filename
try:
command = "cp " + origFile + " " + backupFile
os.system(command)
print "=================================================
======"
print "File backed up at:", backupDir
print "Filename:", filename
print "=================================================
======"
except:
print "Error encountered. Please back up file manually."

You might also like