P
polilop
I need to traverse through a directory,which inside has a directory and
files. I need to save the directory name and files which are inside, to an
array, something like
Array [dirName][fileName] so i can print them out later something like
dirName
fileName
fileName1
dirName1
fileName
fileName1.
(they will be hyperlinks to files)
I have solved the problem of goining into a directory and getting the files
and other directories with a recursive funcition. My problem is how to store
the directory and file names, especially into an array as i dont allways
know how big my array could be.
Thanks in advanced
my recursive function.
public void doTest9( String path)
{
String mainDir = path;
File dir = new File(mainDir);
File[] files = dir.listFiles();
for(int i = 0; i < files.length ; i++)
{
if(files.isDirectory())
{
doTest9(path+"\\"+files.getName()+"\\");
}
}
}
files. I need to save the directory name and files which are inside, to an
array, something like
Array [dirName][fileName] so i can print them out later something like
dirName
fileName
fileName1
dirName1
fileName
fileName1.
(they will be hyperlinks to files)
I have solved the problem of goining into a directory and getting the files
and other directories with a recursive funcition. My problem is how to store
the directory and file names, especially into an array as i dont allways
know how big my array could be.
Thanks in advanced
my recursive function.
public void doTest9( String path)
{
String mainDir = path;
File dir = new File(mainDir);
File[] files = dir.listFiles();
for(int i = 0; i < files.length ; i++)
{
if(files.isDirectory())
{
doTest9(path+"\\"+files.getName()+"\\");
}
}
}