File size: 749 Bytes
d8bfe4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import pandas as pd
import argparse
import shutil
import glob
import os

def safe_copy(src_file, dst_file):
    """
    将 src_file 复制到 dst_file(包括路径),若目标文件夹不存在则自动创建。
    """
    dst_dir = os.path.dirname(dst_file)
    if not os.path.exists(dst_dir):
        os.makedirs(dst_dir)  # 自动创建目标目录
    shutil.copy(src_file, dst_file)
    print(f"Copied: {src_file} -> {dst_file}")

if __name__ == "__main__":
    input_root = r"/data/tts/emogen/gens/hard/"
    save_root = r"/data/tts/emogen/gens/csvs/origin/hard/"
    csv_paths = glob.glob(os.path.join(input_root, "*", "*en*", "metrics_all.csv"))
    for path in csv_paths:
        safe_copy(path, path.replace(input_root, save_root))