[closed] How to get folder path?

edited July 2015 in How To...

While using selectInput() method, I can retrieve the file path but I dont know how to get the folder path in which that file is residing.

what I mean is, I have this

  • I have this: D:\UX UI Refrences\COLORS\Color-Palette-Post-22-barca.png
  • I want this: D:\UX UI Refrences\COLORS

I have tried to do this but it didn't work

    String path = selection.getAbsolutePath();
    println(path.length ());
    for (int i=0; i<path.length (); i++) {
      if ( path.charAt(path.length()-1)!= '\"' ) {
        path = path.substring( 0, path.length()-1 );
        println(i +" : "+ path);
      } else {
        println("found");
        break;
      }
    }

Answers

Sign In or Register to comment.