forked from kathrinse/TabSurvey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_dirs.py
28 lines (24 loc) · 932 Bytes
/
create_dirs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import yaml
# Define the paths
config_dir = 'config'
output_dir = 'output/CatBoost'
# Ensure the output directory exists
os.makedirs(output_dir, exist_ok=True)
# Function to process YAML files
def process_yaml_file(file_path):
with open(file_path, 'r') as file:
data = yaml.safe_load(file)
if 'dataset' in data:
dataset_name = data['dataset']
dataset_dir = os.path.join(output_dir, dataset_name)
if not os.path.exists(dataset_dir):
os.makedirs(dataset_dir)
print(f"Created directory: {dataset_dir}")
else:
print(f"Directory already exists: {dataset_dir}")
# Iterate over YAML files in the config directory
for filename in os.listdir(config_dir):
if filename.endswith('.yml') or filename.endswith('.yaml'):
file_path = os.path.join(config_dir, filename)
process_yaml_file(file_path)