im trying to get every folder of my path. Now Im getting just folders but as soon as some other file comes up it gives me a JavaNullPointerException. I know its beacuse of listFiles() but I dont know how to let it work otherwise. Can someone help me? “ Answer File.listFiles() returns null if the file is not a directory.