For your command line parsing, arrange with the pathname operands to always be the last ones on the command line:
./myscript -a -b -c -- 'foo bar' 'another file' file[12]
The parsing of the options would look something like
a_opt=false b_opt=false c_opt=false
while getopts abc opt; do
case $opt in
a) a_opt=true ;;
b) b_opt=true ;;
c) c_opt=true ;;
*) echo error >&2; exit 1
esac
done
shift "$(( OPTIND - 1 ))"
for pathname do
# process pathname operand "$pathname" here
done
The shift will make sure to shift off the handled options so that the pathname operands are the only things left in the list of positional parameters.
If that's not possible, allow the -i option to be specified multiple times and collect the given arguments in an array each time you come across it in the loop:
pathnames=()
a_opt=false b_opt=false c_opt=false
while getopts abci: opt; do
case $opt in
a) a_opt=true ;;
b) b_opt=true ;;
c) c_opt=true ;;
i) pathnames+=( "$OPTARG" ) ;;
*) echo error >&2; exit 1
esac
done
shift "$(( OPTIND - 1 ))"
for pathname in "${pathnames[@]}"; do
# process pathname argument "$pathname" here
done
This would be called as
./myscript -a -b -c -i 'foo bar' -i 'another file' -i file1 -i file2