This is my code. Basically, I want to filter the filenames and move it in the same folder
String path = System.getProperty("user.dir");
File file = new File(path);
String[] content = file.list();
FilenameFilter textFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
String lowercaseName = name.toLowerCase();
if (lowercaseName.startsWith("to1.")){
File d = new File("TO1");
d.mkdir();
I wanted to move all the files with the prefix with TO1.
into the same folder
somehow I don't know how to implement the move in java. what can you guys recommend?