This is a simple function to find unique file extensions from a given starting point. So for example .txt would be recorded the first time it is found but any further instances will be ignored.

import os

def get_all_extentions(start):
  """
   Find all unique file extensions from a given starting point.

   Parameters
   ----------
   start: The PATH to start searching from

   Examples might be "E:/" or "C:/Users/"

   Returns a list of extentions.
  """
    
  extentions = []
  all_files=[]


  for root,dirs,files in os.walk(start,  topdown=True):
      for name in files:
        name_str = os.path.join(root, name)
        all_files.append(name_str)
      for name in dirs:
        name_str = os.path.join(root, name)
        all_files.append(name_str)

  for file in all_files:
       ext = os.path.splitext(file)[-1].lower()
       if ext not in extentions:
          extentions.append(ext)

  return extentions

for extention in get_all_extentions("E:/VirtualBox VMs"):
  print(extention)