Follow these steps to implement the example:
- Create a class named FileSearch and specify that it implements the Runnable interface. This class implements the operation of searching for files with a determined extension modified in the last 24 hours in a folder and its subfolders:
public class FileSearch implements Runnable {
- Declare a private String attribute to store the folder in which the search operation will begin:
private final String initPath;
- Declare another private String attribute to store the extension of the files we are going to look for:
private final String fileExtension
- Declare a private List attribute to store the full path of the files we will find with the desired characteristics:
private ...