h_flip_folder.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #! /bin/bash
  2. if [ -z "$1" ]
  3. then
  4. echo "No argument supplied"
  5. echo "Need folder argument"
  6. exit 1
  7. fi
  8. if [ -z "$2" ]
  9. then
  10. echo "No argument supplied"
  11. echo "Need output extension"
  12. exit 1
  13. fi
  14. if [ -z "$3" ]
  15. then
  16. echo "No argument supplied"
  17. echo "Need output folder"
  18. exit 1
  19. fi
  20. main_folder=$1
  21. prefix="p3d_"
  22. build_folder="build"
  23. ext=$2
  24. output_folder=$3
  25. for folder in $(ls ${main_folder})
  26. do
  27. echo $folder
  28. mkdir -p ${output_folder}/${folder}
  29. for file in $(ls ${main_folder}/$folder)
  30. do
  31. filename=${main_folder}/${folder}/${file}
  32. filename_fixed=${filename//\/\//\/}
  33. IFS='.' read -ra ADDR <<< "${file}"
  34. filename_without_ext=${ADDR[0]}
  35. outfile="${filename_without_ext}.${ext}"
  36. echo ${filename_fixed}
  37. echo ${output_folder}/${folder}/${outfile}
  38. #check if filename contains
  39. # if [[ "$file" == ${prefix}* ]]; then
  40. ./${build_folder}/main/rawls_h_flip --image ${filename_fixed} --outfile ${output_folder}/${folder}/${outfile}
  41. # fi
  42. done
  43. done