Create yaml wildcard from txts files (directories include)

Create a yaml file from a directory
Prerequisites:
Before running the script, ensure you have Python installed on your system (version 3.x recommended).
Step-by-Step Usage:
Download and Prepare the Script:
Save the
dir_to_yaml.pyscript to your local machine. Ensure it is placed in the root directory where your text files and sub-directory are stored.Script Execution:
Open a terminal or command prompt and navigate to the directory containing the
dir_to_yaml.pyscript. Run the script by typing:python dir_to_yaml.pyProvide YAML Filename:
The script will recursively process the current directory (where the script is executed) and all its subdirectories, converting text files into a structured YAML file. Once completed, you will see a
Done!message.
Example:
Suppose you have the following directory structure:
my_texts/
├── file1.txt
├── file2.txt
└── subdir/
└── file3.txtRunning the script in the my_texts directory and naming the output output.yaml will produce a YAML file structured like this:
file1:
- Line from file1
- Another line from file1
file2:
- Line from file2
subdir:
file3:
- Line from file3
- Another line from file3Troubleshooting:
Ensure you have the pyyaml library installed. You can install it using pip if you don't already have it:
pip install pyyaml