Hey, Is it possible to get all the folders names that are inside a folder?
A way to do that is: (File.getList()).isDirectory but is there a better way than this? Thanks.
Hey, Is it possible to get all the folders names that are inside a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think that use
File.listFiles(), then checkingisDirectory()on each, is a fine solution.If you want to get fancy, you could use
File.listFiles(FileFilter), then implement aFileFilterthat only accepts files that pass theisDirectory()test. It would essentially be the same solution but could possibly simplify your code.