def searchSqlite(profil):
    "all sqlite file in each firefox profile"
                                             
    if not os.path.isdir(profil):            
        return

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