I just want to know whether is there a way to get a portion of the total files from a directory so that I can move the portion of files to another directory. For example I have 1000 files in a directory and I want to move 200 of these files to another directory then will continue move another 200 and so on. The only way I can think of is using counting such as starting count from 1 till 200. Is there a way to make the hasnext() method to stop at 200 records when looking for files? Or is there another java method to do this. Thanks and much appreciated.
Do you have a loop now that moves all files? What does it look like?
The cleaner way to terminate a looping routine is to do it in your while() or for() condition. If you have while( hasNext() ) now, how would you change it to stop at 200? A much uglier way is to "break" the loop. How would you make break happen after 200 files?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi