code: def ftp_walk(ftpconn: FTP, rootpath=''):
      
  
      current_directory = rootpath
  
      try:
          directories, files = directory_listing(ftpconn, current_directory)
      except ftplib.error_perm:
          return
  
      # Yield before recursion
      yield current_directory, directories, files
  
      # Recurse into sub-directories
      for name in directories:
          new_path = os.path.join(current_directory, name)
  
          for entry in ftp_walk(ftpconn, rootpath=new_path):
              yield entry
      else:
          return
docs: Recursively traverse an ftp directory to discovery directory listing.