List visible files

0

When I do this in a program:

File[] ficheros2=new File(".").listFiles(new FileFilter() { 
public boolean accept(File fichero2) {
return fichero2.isFile();
}
});            
for(File fichero :ficheros2) {
  System.out.print( ficheros2.length+ "                  ");
  System.out.print(fichero.getName()+"            ");
  System.out.println(fichero.getAbsoluteFile())   ;   
}                      }
     catch(Exception e) {
     }

I get a list of all the files (ONLY FILES NOT DIRECTORS) So far right .. But how can I make it so that it does not show me the hidden ones?

I need the program to show me the visible files. The hidden ones that avoid them.

For hidden I know that isHidden exists but for the visible ones? Maybe it has to be done with isHidden but I do not see the way ..

thanks!

    
asked by Montse Mkd 23.02.2017 в 19:32
source

1 answer

1

Maybe you could deny the condition:

File[] ficheros2=new File(".").listFiles(new FileFilter() { 
    public boolean accept(File fichero2) {
        return fichero2.isFile() && !fichero2.isHdden();
    }
});            
    
answered by 23.02.2017 / 19:57
source