Java examples for File Path IO:Directory
Get parent directory as a File object
import java.io.*; public class Main { public static void main(String[] args) { File file = new File("C://Folder/demo.txt"); File fileParent = file.getParentFile(); System.out.println("Parent directory is : " + fileParent.getPath()); }//from ww w . ja v a 2 s . com }