Is it possible to move to a directory one level down in Java?
For example in command prompt:
C:\Users\foo\
I can use cd.. to go to:
C:\Users\
Is it possible to do this in Java, because I’m getting a directory using System.getProperty(“user.dir”); however that is not the directory I’d want to work at, but rather 1 level down the directory.
I have thought of using the Path class method; subpath(i,j), but if the “user.dir” were to be changed to another directory, then the returned subpath would be different.
The File class can do this natively.
http://docs.oracle.com/javase/6/docs/api/java/io/File.html#getParentFile%28%29