import os def log_zip_files(root_folder, output_file): with open(output_file, "w") as f: for dirpath, dirnames, filenames in os.walk(root_folder): for file in filenames: if file.lower().endswith(".zip"): # Remove the .zip extension and write only the file name file_name_without_ext, _ = os.path.splitext(file) f.write(file_name_without_ext + "\n") if __name__ == "__main__": # Set the directory you want to start searching from; here it's the current directory root_folder = "." output_file = "log.txt" log_zip_files(root_folder, output_file) print(f"ZIP file names without extension logged in '{output_file}'.")