Created
August 20, 2012 09:01
-
-
Save benhosmer/3402494 to your computer and use it in GitHub Desktop.
A python script that uses Google Sync Utilities to back up a mysql database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
backup_dir = os.getcwd() + "/backups" | |
os.chdir(backup_dir) | |
files = filter(os.path.isfile, os.listdir(backup_dir)) | |
files = [os.path.join(backup_dir, f) for f in files] # add path to each file | |
#files.sort(key=lambda x: os.path.getmtime(x)) | |
sortedFiles = files.sort(key=lambda fn: os.path.getmtime(os.path.join(backup_dir, fn))) | |
print "\n" | |
print files | |
print "\n" | |
print "Backup Directory: " + backup_dir | |
print "\n" | |
print sortedFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment