Say I have a particular directory somewhere on my system.
C://Users/Public/Local/AppData/saves
I want to read this whole directory and check if the files in it have a particular extension or not. Say .json
for example.
If the directory has multiple files with the extension .json
list all those files with their names.
I could use
File file = new File(myPath);
and do file.exists()
continuously but how can I scan the whole directory for files?
Here is what I am confused with.
Any help will be much appreciated. Thanks.