I have a directory with several folders (only interested in folders one level deep) and each one of these folders have files inside (values.yaml and example.yaml)
folder_1
-values.yaml
-example.yaml
folder_2
-values.yaml
-example.yaml
...
values.yaml is a valid yaml file with several values
example of values.yaml for folder 1
name: John
age: 66
country:
name: Spain
lenght: 32
...
example of values.yaml for folder 2
name: Simon
age: 90
country:
name: France
lenght: 33
...
I have to iterate through every single one of these directories and build an yaml file where I put the folder name concatenated with a certain string (eg:-batch) and put all values from values.yaml from this folder inside this field
Example of final output
folder_1-batch
name: John
age: 66
country
name:Spain
lenght: 32
...
folder_2-batch
name: Simon
age: 90
country:
name: France
lenght: 33
...
Any ideia how I could do this? I am able to copy all the content from every single values.yaml to a new file, but I am not understanding how I can put this content inside the main field (folder concatenated with -batch) with the correct indentation of a yaml file
small update: folders can have any name, and do not follow any pattern (folder_1 and folder_2 was just an example)