Download data_tool/folder_tool.py from vegagoto123/gha: direct link, hf CLI and curl.
- Browser
- Download file 675 Bytes
-
https://huggingface.co/vegagoto123/gha/resolve/main/data_tool/folder_tool.py
- Command line
-
hf download hf://vegagoto123/gha/data_tool/folder_tool.py
-
curl -L -o folder_tool.py https://huggingface.co/vegagoto123/gha/resolve/main/data_tool/folder_tool.py
675 Bytes
| import os | |
| import shutil | |
| # 获取当前目录下的所有子文件夹 | |
| subfolders = [f.path for f in os.scandir('/data_160TB/2021/yangkun/gha-gaussian/datasets/eg3d_data/data_new/view3-m2/') if f.is_dir()] | |
| # 遍历每个子文件夹 | |
| for folder in subfolders: | |
| # 检查子文件夹中是否存在名为"mask"的父文件夹 | |
| if not any('masked' in f.path for f in os.scandir(folder) if f.is_dir()): | |
| # 删除没有名为"mask"的父文件夹的子文件夹 | |
| shutil.rmtree(folder) | |
| # mask_path = os.path.join(folder, "masked") | |
| # mask_num = len(os.listdir(mask_path)) | |
| # if mask_num != 120: | |
| # shutil.rmtree(folder) | |
| # print(mask_path) |