def clean_old_files(directory):
 for (root, dirs, files) in os.walk(directory, topdown=False):
  for f in files:
   if fnmatch(f, '*.package-control-old'):
    path = os.path.join(root, f)
    try:
     os.remove(path)
    except OSError as e:
     console_write(u'\n                        Error removing old file "%s": %s\n                        ', (path, unicode_from_os(e)))

def clean_old_files ( directory ) : for ( root , dirs , files ) in os . walk ( directory , topdown = False ) : for f in files : if fnmatch ( f , '*.package-control-old' ) : path = os . path . join ( root , f ) try : os . remove ( path ) except OSError as e : console_write ( u'\n                        Error removing old file "%s": %s\n                        ' , ( path , unicode_from_os ( e ) ) )
goes through a folder and removes all .