def searchSqlite(profile):
    "all sqlite file in each firefox profile"
    sq=[os.path.join(profile,s) for s in os.listdir(profile) if s.endswith(".sqlite")]
    print "\n..."+profile[len(profileUser):]
    for s in  sq:
        dirName, fileName=os.path.split(s)
        conn = sqlite3.connect(s)
        oldSize=os.path.getsize(s)
        print fileName+":",
        try: 
            c=conn.cursor()
            c.execute("VACUUM")  # this is the thing
            c.close()
            print "done.",
            print "%.1f%%" % (os.path.getsize(s)*1.0/oldSize*100)
            
        except:
            print "error."
all sqlite file in each firefox profile
recipes/Python/576842_firefox_sqlite_files_cleaner/recipe-576842.py