随笔 - 633,  文章 - 0,  评论 - 13,  阅读 - 48万
< 2025年3月 >
23 24 25 26 27 28 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 29
30 31 1 2 3 4 5
代码:
复制代码
import os


def get_fbx_files_and_write_to_txt(folder_path, output_file_path):
    fbx_files = []
    # 遍历指定文件夹中的所有文件
    for item in os.listdir(folder_path):
        item_path = os.path.join(folder_path, item)
        # 检查是否为文件,并且文件扩展名为.fbx
        if os.path.isfile(item_path) and item.lower().endswith('.fbx'):
            fbx_files.append(item)

    # 将获取到的fbx文件名写入到指定的文本文件中
    with open(output_file_path, 'w', encoding='utf-8') as txt_file:
        for fbx_file in fbx_files:
            txt_file.write(fbx_file + '\n')  # 每个文件名后面添加换行符

    print(f"所有.fbx文件名已写入到 {output_file_path}")


# 指定你想要搜索的文件夹路径
folder_path = r'C:\Users\相晓征\AppData\Roaming\Blender Foundation\Blender\4.1\scripts\addons\pUPA\animations\sport'  # 请替换为你的文件夹路径
# 指定输出文本文件的路径
output_file_path = r'./path_to_your_output_file.txt'  # 请替换为你想要保存的文件路径

get_fbx_files_and_write_to_txt(folder_path, output_file_path)
复制代码

 

posted on   大话人生  阅读(59)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2022-04-19 ubuntu设置数据库远程登录
点击右上角即可分享
微信分享提示