Java tutorial
//package com.java2s; public class Main { public static String getPathFromFilepath(String filepath) { int pos = filepath.lastIndexOf('/'); if (pos != -1) { return filepath.substring(0, pos); } return ""; } }