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

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...
//start paginationJs //end paginationJs