I'm doing a program which can count the amount of selected elements in a folder, this using JFileChooser.
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser selecto = (JFileChooser) e.getSource();
String comand = e.getActionCommand();
if (comand.equals(JFileChooser.APPROVE_SELECTION)) {
File archivoSelect = selecto.getSelectedFile();
JOptionPane.showMessageDialog(this, "Guardado archivo " + archivoSelect.getName());
System.out.println("Path: "+archivoSelect.getPath());
System.out.println("Elementos de la carpeta: "+archivoSelect.list.length);
}
}
But I've noticed that certain folders contain hidden files created by the PC such as thumbs.db files and this causes the program to deliver a number of files that do not match those seen simple you saw, so my question would be how to prevent the program from counting the hidden files.
I appreciate any help.