Java examples for File Path IO:Directory
Get name of parent directory
import java.io.*; public class Main { public static void main(String[] args) { File file = new File("C://MyFolder/demo.txt"); String strParentDirectory = file.getParent(); System.out.println("Parent directory is : " + strParentDirectory); }//from ww w .j a v a 2 s. c om }