![]() |
if(files[i].isDirectory())
{
depthFirstSearch(files[i]);
}
Here, depthFirstSearch(File) is the search function that
processes a file or directory. To list up all the files under a
directory, call listFiles() function of the
File class.
int i;
File [] files;
for(files=dir.listFiles(), i=0;files!=null && i<files.length; i++)
{ ...
}
Suppose, say, you want to list up every file under a directory that contains non BASIC_LATIN character in its file name.
if(Character.UnicodeBlock.of(ch)!=Character.UnicodeBlock.BASIC_LATIN)
{
found=true;
}
Click here for a sample Java source code which does a depth first search of a directory. This program searches every file under a directory which is specified as an argument (current directory if no directory is specified), and prints out the path names of the files that have any character that contain non BASIC_LATIN character.