I have a basic flask app which is used to get logs from pods. I want to use send_from_directory when the query is not complete. I do not want to create a zip file and list it rather I would like to list the logs files that are generated with the query. from flask import Flask, send_from_directory from flask import request import http.server import socketserver import subprocess import os import sys from urllib.parse import urlparse from urllib.parse import parse_qs app = Flask(__name__) # write route for a namespace completely @app.route('/logs') def hello_world(): umgebung = request.args.get('umgebung', None) product = request.args.get('product', None) product_type = request.args.get('product_type', None) output = (subprocess.check_output(['cmd', '/c', f'oc logs --tail=-1 -n awl-{umgebung} -l product={product},type={product_type}'])).decode(); if not output: output_as = (subprocess.check_output(['cmd', '/c', f'oc logs --tail=-1 -n awl-{umgebung} -l product={product},type=as'])).decode(); output_db = (subprocess.check_output(['cmd', '/c', f'oc logs --tail=-1 -n awl-{umgebung} -l product={product},type=db'])).decode(); output_as_file = open ("logs/output_as_log.log","w") output_db_file = open ("logs/output_db_log.log","w") output_as_file.write(output_as) output_db_file.write(output_db) path= 'logs' return send_from_directory(path, output_as_file,as_attachment=True) #HERE I DO NOT UNDERSTNAD WHAT SHOUDL BE GIVEN output = "<br />".join(output.split("\n")) return output I am creating the log files under the logs folder within the project folder. How can i display all the files in the folder log ? So that it can be downloaded with a click? Clarification for the close Votes!! The app should return the files from a particular folder. But the send_fron_directory is not working as expected. Continue reading...