Find files in a folder using Java

Posted by Sii on Stack Overflow See other posts from Stack Overflow or by Sii
Published on 2011-01-31T15:18:27Z Indexed on 2011/01/31 15:25 UTC
Read the original article Hit count: 208

Filed under:
|
|
|
|

Hello, I'm new here so be kind to my stupidity :)

What I need to do if Search a folder say C:\example

I then need to go through each file and check to see if it matches a few start characters so if files start

temp****.txt
tempONE.txt
tempTWO.txt

So if the file starts with temp and has an extension .txt I would like to then put that file name into a File file = new File("C:/example/temp***.txt); so I can then read in the file, the loop then needs to move onto the next file to check to see if it meets as above.

I hope this makes sense, thanks for taking the time to view this I do apperciate it :)

© Stack Overflow or respective owner

Related posts about java

Related posts about file