someone can check these code.I want to copy the files one folder to another folder.
import java.io.File;
import java.io.*;
public class readfile {
public static void main (
String[] arg0)throws Exception{
// you could put your directory here
String pathin = "D:\\Novels";
File filein = new File(pathin);
String[] filelist = filein.list();
int lenin = filelist.length;
File dir=new File("C:\\v");
if (filelist.length == 0) {
System.out.println("empty file in the dirc");
}else{
// define a value for reading the file random
for (int j = 0 ; j < lenin ; j++) {
int index = (int)(Math.random()*lenin);
File newfilein = new File( filelist[index]);
boolean copy= newfilein.renameTo(new File(dir, newfilein.getName()));
System.out.println("name= " + newfilein.getName());
// filelist[index] = filelist[lenin -1];
//lenin --;
}
}
}
}