Here you can find the source of renameFiles(File fileDirectory, String regex, String replacement)
public static void renameFiles(File fileDirectory, String regex, String replacement)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static void renameFiles(File fileDirectory, String regex, String replacement) { for (File file : fileDirectory.listFiles()) { File newFile = new File(file.getAbsolutePath().replaceFirst(regex, replacement)); file.renameTo(newFile);//from w ww . ja v a 2 s .c om } } }