Find parent Directory in java

Read : Create File using createNewFile() method in java file IO

Program to Find parent Directory in java >

/** */
public class FindParentDirectory {
   public static void main(String[] args) {
          String fileName = "c:/myFile.txt";
          File file = new File(fileName);
          System.out.println("Parent directory of " + fileName + " is "+ file.getParent());
Parent directory of c:/myFile.txt is c:\


Find the available filesystem roots in java/ Available disk drives in windows

Execute CMD command through java program >

Execute CMD commands through java program

Must read for you :