#!/usr/bin/env python3 import os # Get the current directory current_directory = os.getcwd() # Define the name of the merged file merged_file_name = "merged.md" # Open the merged file in write mode with open(merged_file_name, "w") as merged_file: # Iterate over all files and directories in the current directory for root, dirs, files in os.walk(current_directory): for file in files: # Get the file path file_path = os.path.join(root, file) # Open each file in read mode with open(file_path, "r") as current_file: # Read the contents of the file file_contents = current_file.read() # Write the contents to the merged file merged_file.write(file_contents)