You can do:
# use nullglob in case there are no matching files
shopt -s nullglob
# create an array with all the filer/dir inside ~/myDir
arr=(~/myDir/*)
# iterate through array using a counter
for ((i=0; i<${#arr[@]}; i++)); do
#do something to each element of array
echo "${arr[$i]}"
done
You can also do this for iteration of array:
for f in "${arr[@]}"; do
echo "$f"
done