I need to evaluate the file content of a ArrayList<String>
called ArrayArchives , which contains the files raised by extension of a specific address, which I do to raise those extensions.
public void buscarArchivo(File ruta) {
// Creo el vector que contendra todos los archivos de una ruta especificada.
File[] archivo = ruta.listFiles();
// Evaluo si la carpeta especificada contiene archivos.
if (archivo != null) {
// Recorro el vector el cual tiene almacenado la ruta del archivo a buscar.
for (int i = 0; i < archivo.length; i++) {
File Arc = archivo[i];
// Evaluo si el archivo o la ruta es una carpeta.
if (archivo[i].isDirectory()) {
// Le paso la nueva ruta de la carpeta si se cambia la ruta e busca nuevamente.
buscarArchivo(archivo[i]);
} else {
// Evaluo el tipo de extencion.
if (archivo[i].getName().endsWith(".pnd") || archivo[i].getName().endsWith(".ana") || archivo[i].getName().endsWith(".cnf")) {
contador++;
arrayArchivos.add(archivo[i].getName());
System.out.println("Lo que hay en el array es: " + arrayArchivos);
>>>Aquí necesitaría preguntar si existen archivos en el arraylist con las 3 extensiones que levanto de la carpeta.
Los cuales son .pnd .ana .cnf<<<
}
}
}
}
}
- I need to know if there are 3 extensions inside the arraylist, regardless of the number of files it finds, if there are three extensions that do not do anything.
- There may be up to 2 files with the same name but with different extension eg: ( juan.pnd and juan.ana ) or ( juan.pnd and juan.cnf ) in that case do nothing.
- There may also be only two extensions, for example: pedro.cnf and pablo.ana
- There can also be only 1 extension, for example: .ana alone or the .cnf alone.
- The system should only do something if . . . . .pnd does not exist in the .pnd without the existence of the other two. In that case, only in that case that I trigger an arteta that what is in the
arrayArchivos
are only files with extension .pnd
I hope I have been clear about what I need, I would greatly appreciate your help, thank you very much.