Skip to content

Instantly share code, notes, and snippets.

@benhosmer
Created August 20, 2012 09:01
Show Gist options
  • Save benhosmer/3402494 to your computer and use it in GitHub Desktop.
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.
#!/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