I have the following program:
File[] ficheros2=new File(".").listFiles(new FileFilter() {
public boolean accept(File fichero) {
return fichero.isFile();
}
});
int ocultos2=0;
int totalFicheros=0;
for(File fichero :ficheros2) {
//System.out.println(fichero.getName()); //Si queremos mostrar todas las carpetas
// OCULTOS
if (fichero.isHidden() ){
System.out.println("L'arxiu es ocult." +args[0]);
ocultos2++;
}
if (!fichero.isHidden() ) {
System.out.println("L'arxiu es lliure"+args[0]);
totalFicheros ++;
}}
System.out.println("Numero de ficheros visibles "+totalFicheros);
System.out.println("Número de ficheros ocults :"+ocultos2);
I have no idea how to compare the files with argumento[0]
.
That is to say
if (!fichero.isHidden() ) {
It should be something like this:
if(!fichero.isHidden() && fichero.equals(args[0])
.
I have tried with equals, ==, and a thousand other things ... but there is nothing that works for me .. Can you tell me what I can compare them with?
The idea of the program in summary mode is:
El Filtro me saca solo los archivos.
Si el fichero es oculto y es igual que el argumento
......
Si el fichero es visible y es igual que el argumento
.....
thanks!