Download ObjaverseLVIS/split.sh from OpenDlign/OpenDlign-Datasets: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/datasets/OpenDlign/OpenDlign-Datasets/resolve/main/ObjaverseLVIS/split.sh
- Command line
-
hf download hf://datasets/OpenDlign/OpenDlign-Datasets/ObjaverseLVIS/split.sh
-
curl -L -o split.sh https://huggingface.co/datasets/OpenDlign/OpenDlign-Datasets/resolve/main/ObjaverseLVIS/split.sh
1.15 kB
| # Change to the directory with the files | |
| cd /mnt/sda/OpenDlign-Datasets/shapenet/depth_align_img/ | |
| # Directory where the subdirectories will be created | |
| base_dir=$(pwd) | |
| # Maximum number of files per directory | |
| max_files_per_dir=10000 | |
| # Create a counter to keep track of subdirectory number | |
| dir_counter=1 | |
| # Array to hold files | |
| files=(*) | |
| # Total number of files | |
| total_files=${#files[@]} | |
| # Loop through all files and move them to appropriate subdirectories | |
| for (( i=0; i<$total_files; i+=$max_files_per_dir )); do | |
| # Create new subdirectory | |
| new_dir="${base_dir}/part${dir_counter}" | |
| mkdir -p "${new_dir}" | |
| # Compute the slice of files to move | |
| # Bash doesn't handle large arrays well, so we process them in chunks | |
| (( slice_end=i+max_files_per_dir-1 )) | |
| if [ $slice_end -ge $total_files ]; then | |
| slice_end=$total_files | |
| fi | |
| # Move files to new directory | |
| echo "Moving files ${i} to ${slice_end} to ${new_dir}" | |
| mv "${files[@]:$i:$max_files_per_dir}" "${new_dir}" | |
| # Increment the directory counter | |
| dir_counter=$((dir_counter+1)) | |
| done | |
| echo "All files have been moved into subdirectories." | |