Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to get the parents of an file

Java: How to get the parents of an file
{filelink=7951}

import java.io.File;
import java.io.IOException;
public class File_P
 {
  public static void main(String[] argv) throws IOException
  	{
    File file = new File("c:/test2test.txt");
    // Get the name of the parent
    String ch_parent = file.getParent();
    System.out.println(ch_parent);
    // get parent directory
    File rep_parent = file.getParentFile();
    System.out.println(rep_parent);
  }
}

Users who found this page were searching for:

  • count lines perl
  • Python Check File Extension
  • how to get last week in java
  • Base64
  • iterate dictionary python
  • sql query read csv
  • perl factorial
  • java program that prints a calendar
  • print working directory python

No comments yet.

Leave a Comment