Backup Pythonista Scripts to Dropbox

Backup Pythonista Scripts to Dropbox

This is a follow-up article to my recent post on "How I get my SQLite database onto my iOS devices using Pythonista".

I have the simple script and every time I make a change, or I add a new script in, I will run this and it will push all the scripts into dropbox for me.  I have a separate folder and store them different from all the other scripts I have.

import os
import dropbox
from dropboxlogin import get_client

dropbox_client = get_client()

for file in os.listdir('.'):
	if file.endswith(".py"):
		print file
		f=open(file,'r')
		dropbox_client.put_file('My_Backups/Pythonista/'+file,f)
		f.close()

This is allows me to just write and test the code, then when I add in all the comments and descriptions, my usual headers etc, I can do this on my setup when I have a proper keyboard , etc.

You could also adapt this if you have other documents stored in Pythonista, text files, log files for example.  As you can see this filters on just *.py files.

You can find these scripts all up on my Github.

I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me  here.

Related Posts Plugin for WordPress, Blogger... 

 

3 Wonderful Facts You Never Knew About Technology

How I get my SQLite database onto my iOS devices using Pythonista

How I get my SQLite database onto my iOS devices using Pythonista