Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
Function SearchFile(name, dir)
While (entry = GetNextEntry(dir)) {
If (entry.Name == "." || entry.Name == "..") {
continue;
}
If (entry.Type == DIRECTORY) {
FoundFile = SearchFile(name, entry);
if (FoundFile) {
return FoundFile;
}
}
Else If (entry.Type == FILE && file.Name == name) {
return entry;
}
}
return NULL;
}
package Ordnersuche;
import java.io.File;
import java.io.FileFilter;
public class Suche {
public static void main(String[] args)
{
FileFilter f = new MyFile();
System.out.println(Suche.sucheOrdner("myChat",File.listRoots(),f));
}
public static String sucheOrdner(String name, File[] files,FileFilter f)
{
//RekursionsEnde
if(files.length==0||files==null)
{
return "Not Found!";
}
else
{
for(File file : files)
{
if(file.getName().equals(name)) //suche name in derzeitigen subordnern
{
return file.getPath();
}
}
//wenn ordner noch nicht gefunden durchsuche subordner
for(File file : files)
{
if(file.listFiles(f)!=null)
{
String s = sucheOrdner(name,file.listFiles(f),f);
if(s!=null&&!s.equals("Not Found!"))
return s;
}
}
}
return "Not Found!";
}
}
class MyFile implements FileFilter
{
// Muster für files
//da du einen ordner suchst, brauchen wir uns auch nur ordner angucken.
//versteckte ordner sparen wir uns auch mal
@Override
public boolean accept(File pathname) {
return pathname.isDirectory()&&!pathname.isHidden();
}
}