read files names from directory without System fil

2019-09-18 19:33发布

问题:


Im trying to read all filenames from a folder and save them in an array but im still reading all files (including the system folder .DS_Storefrom)so that my code doesn´t work for what i want to do. anyone knows how to read only non Systems files/folder? Thanks for the help!

Here´s what i wrote,

String pathLevel= "/Users/lan/Desktop/top/";


        File file = new File(pathLevel);
        String [] levelNames = file.list();
        String [] matrix= new String[levelNames.length];