while read inum rest; do dest="/mnt/recovered/apr29/${inum}" mkdir -p "${dest}" python3 dump_tree.py --skip-existing ${inum} "${dest}/" & while (( $(jobs -r | wc -l) >= 10 )); do wait -n 2>/dev/null || sleep 0.2 done done < true_roots.txt wait echo "All done"