in java how to get files in a given directory

前端 未结 2 720
梦如初夏
梦如初夏 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: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.

提交回复
热议问题