So basically I am using Eclipse to program in java and I have a workspace where my project folder is. By default, when no directory is specified when writing a file (eg "./file.txt"), the file gets saved in the Project folder/directory.
Now, what I want to do is find a file or files in my project directory that ends in a certain parttern/extension/whatever (eg "le.txt"), which would probably return true or a list of the files names that end that way (depending on how the method is written) in which probably the file "file.txt" from the first example would be included.
I found this in the internet and was attempting to use it as a guideline to make my own code, but found a few problems hard to solve:
Thank you, and I hope this question doesn't sound too ambiguous despite that I have 2 questions...
How can I use the GUI search feature?
Search → File... or Ctrl - H .
You can filter using a file name pattern in the "File name patterns" input field.
The current directory is '.' (the dot). Do you want to search all subdirectories recursively, or are the file you want in a single directory? In the latter case a new File("./subdir").list() suffices. Also, do you want them packaged with your class files? If yes, consider putting them in a package and use this.getClass().getClassLoader().getResources().
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.