123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #! /bin/bash
- if [ -z "$1" ]
- then
- echo "No argument supplied"
- echo "Need folder argument"
- exit 1
- fi
- if [ -z "$2" ]
- then
- echo "No argument supplied"
- echo "Need output extension"
- exit 1
- fi
- if [ -z "$3" ]
- then
- echo "No argument supplied"
- echo "Need output folder"
- exit 1
- fi
- main_folder=$1
- prefix="p3d_"
- ext=$2
- output_folder=$3
- for folder in $(ls -d -- ${main_folder}*/)
- do
- for scene in $(ls -d $folder)
- do
- for file in $(ls $folder)
- do
- filename=$folder$file
- filename_fixed=${filename//\/\//\/}
- IFS='/' read -ra ADDR <<< "${scene}"
- folder=${ADDR[-1]}
- # get output expected path
- output_scene_path=$output_folder/$folder
-
- IFS='.' read -ra ADDR <<< "${file}"
- filename_without_ext=${ADDR[0]}
- outfile="${filename_without_ext}.${ext}"
- # check if filename contains
- if [[ "$file" == ${prefix}* ]]; then
- echo ./main/rawls_convert --image ${filename_fixed} --outfile ${output_scene_path}/${outfile}
- fi
- done
- done
- done
|