change_ext_all.sh 734 B

123456789101112131415161718192021222324252627282930313233343536
  1. #! /bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need previous extension used"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need new extension to use"
  12. exit 1
  13. fi
  14. main_folder="./"
  15. prefix="p3d_"
  16. previous=$1
  17. new_ext=$2
  18. for folder in $(ls -d -- ${main_folder}*/)
  19. do
  20. for file in $(ls $folder)
  21. do
  22. filename=$folder$file
  23. filename_fixed=${filename//\/\//\/}
  24. # check if filename contains
  25. if [[ "$file" == ${prefix}* ]]; then
  26. echo "Update image extension (.${previous} to .${new_ext}) into ${filename_fixed}"
  27. python utils/change_ext_pbrt.py --prefix ${prefix} --pbrt ${filename} --previous ${previous} --ext ${new_ext}
  28. fi
  29. done
  30. done