Java tutorial
//package com.java2s; public class Main { /** * get the file name from its absolute path * * @param path * @return */ public static String pathToName(String path) { String[] parts = path.split("/"); String fileName = parts[parts.length - 1]; String[] nameParts = fileName.split("[.]"); String getName = ""; for (int m = 0; m < nameParts.length - 1; m++) { getName = getName + nameParts[m]; } return getName; } }