Download utils/create_same_dir.py from rrlab/RHLH-LVMs: direct link, hf CLI and curl.
- Browser
- Download file 763 Bytes
-
https://huggingface.co/rrlab/RHLH-LVMs/resolve/main/utils/create_same_dir.py
- Command line
-
hf download hf://rrlab/RHLH-LVMs/utils/create_same_dir.py
-
curl -L -o create_same_dir.py https://huggingface.co/rrlab/RHLH-LVMs/resolve/main/utils/create_same_dir.py
763 Bytes
| import os | |
| def create_mirror_structure(source_dir, target_dir): | |
| # | |
| if not os.path.exists(source_dir): | |
| raise ValueError(f"Source directory {source_dir} does not exist.") | |
| # | |
| for root, dirs, files in os.walk(source_dir, topdown=False): | |
| # | |
| for dir in dirs: | |
| relative_path = os.path.relpath(os.path.join(root, dir), source_dir) | |
| # | |
| target_subdir = os.path.join(target_dir, relative_path) | |
| if not os.path.exists(target_subdir): | |
| os.makedirs(target_subdir) | |
| # | |
| source_directory = '/mnt/RHLH-LVMs/Dataset_Demo/Town_demo_house' # | |
| target_directory = '/mnt/RHLH-LVMs/Dataset_Demo/Town_demo_house_copy' # | |
| create_mirror_structure(source_directory, target_directory) | |