java去除字符串中的特定字符

public static void updateFileNames(String url, String index){
        File file = new File(url);
        //判断文件目录是否存在,且是文件目录,非文件
        if(file.exists() && file.isDirectory()){
            File[] childFiles = file.listFiles();
            String path = file.getAbsolutePath();
            for(File childFile : childFiles){
                //如果是文件
                if(childFile.isFile()){
                    String oldName = childFile.getName();
                    String newName = oldName.substring(oldName.indexOf(index));
                    
                    childFile.renameTo(new File(path + "\\" +  newName));
                }
            }
        }