title: ls or dir - limit the number of file name returns
body: <p>Is there a way to limit the number of filenames to be returned using the ls or dir command? I'm on a windows machine with cygwin, so either command will do.</p>
  
  <p>I have a directory with over 1 million docs that I need to batch out into subfolders. I'm looking to write a simple script that would list the first 20,000 or so, move them to a subfolder, then repeat on the next 20,000. I would expect ls or dir to have an option to list only a certain number of files, but I can't seem to find a way to do it.</p>
  
  <p>My other option is to print the filenames out to a text file and parse that to make the moves. It seems like there should be a simpler solution though.</p>