| Author |
Move portion of files from directory
|
michael yue
Ranch Hand
Joined: Nov 20, 2003
Posts: 204
|
|
Hi 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.
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
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
|
 |
 |
|
|
subject: Move portion of files from directory
|
|
|