title: Iterate over files in directory using bash script
body: <p>I would like to iterate over the files in given directory. I tried using the for loop for the same... but I have one another loop inside this loop where I need to read multiple files till the condition is true within that loop to upload at a time... but withing inner loop I am able to access only one file since file iterator loop is outside the inner loop.
  Is there any thing like file.getNext so that i can access number of files inside the loop without using index/loop.</p>
  
  <p>I need something like this:</p>
  
  <pre><code>while [ count -le $uploadRate ]
  do
     files="$files,directory.getNextFile"
     $(curl -o $log_Path -T "{$files}" url)
  done
  </code></pre>
  
  <p>where <code>$files</code> will have number of files uploaded at a time
  I don't want to load the files into array since directory has huge number of files, so array is not feasible option, so would like to iterate over directory like getNext file.</p>