code: def get_all_media(exclude=None):
      
  
      if not exclude:
          exclude = []
  
      media = set()
  
      for root, dirs, files in os.walk(six.text_type(settings.MEDIA_ROOT)):
          for name in files:
              path = os.path.abspath(os.path.join(root, name))
              relpath = os.path.relpath(path, settings.MEDIA_ROOT)
              for e in exclude:
                  if re.match(r'^%s$' % re.escape(e).replace('\\*', '.*'), relpath):
                      break
              else:
                  media.add(path)
  
      return media
docs: Get all media from MEDIA_ROOT