in java how to get files in a given directory

前端 未结 2 713
梦如初夏
梦如初夏 2021-01-23 03:05

I want to write a java code, where given a directory name, I should be able to get all the files starting with list (so something like list*) and read each file one by one (line

相关标签:
2条回答
  • 2021-01-23 03:33

    You can list using a file filter as described here

    0 讨论(0)
  • 2021-01-23 03:47

    Well, the most central class would be File.

    Besides that there are some classes that File's methods need (like FileFilter etc.)

    You can also try and have a look at utility libraries like Apache Commons IO.

    0 讨论(0)
提交回复
热议问题