import os

def clear_files_in_dir(dir_path):
    for filename in os.listdir(dir_path):
        file_path = os.path.join(dir_path, filename)
        if os.path.isfile(file_path):
            os.remove(file_path)

# 示例用法
path = '/home/data1/smn/SPFormer/run'
assert path.endswith("SPFormer/run"), f"Path must end with '/run', but got: {path}" #very important !!!!

clear_files_in_dir(path)