C
Calvin Tai
Dear all,
I have a directory with more than 40000 files inside. I want to write
a java program to do something on each of the file by the following
code.
File sdir = new File(srcDir);
String[] filename = sdir.list();
// For each file, do something
for(int i = 0; i < filename.length; i++)
{
// Do something
}
Since the maximum of integer cannot exceed 40000, the above code will
generate error for sure. Then how can i accomplish the task with files
more than 40000 in a directory? Thanks.
Best regards,
Calvin
I have a directory with more than 40000 files inside. I want to write
a java program to do something on each of the file by the following
code.
File sdir = new File(srcDir);
String[] filename = sdir.list();
// For each file, do something
for(int i = 0; i < filename.length; i++)
{
// Do something
}
Since the maximum of integer cannot exceed 40000, the above code will
generate error for sure. Then how can i accomplish the task with files
more than 40000 in a directory? Thanks.
Best regards,
Calvin