package dummy;
import java.io.File;
public class RenameFilesInADirectory {
public static void main(String[] args) {
File directory = new File("D:\\Songs");
File[] files = directory.listFiles();
for(File file : files) {
// file.toString() gives absolute path to file
file.renameTo(new File(file.toString().replaceAll("_"," ")));
}
}
}
import java.io.File;
public class RenameFilesInADirectory {
public static void main(String[] args) {
File directory = new File("D:\\Songs");
File[] files = directory.listFiles();
for(File file : files) {
// file.toString() gives absolute path to file
file.renameTo(new File(file.toString().replaceAll("_"," ")));
}
}
}