Get the filePath from Filename using Java

user1688404 picture user1688404 · Nov 22, 2012 · Viewed 118.1k times · Source

Is there a easy way to get the filePath provided I know the Filename?

Answer

assylias picture assylias · Nov 22, 2012

You can use the Path api:

Path p = Paths.get(yourFileNameUri);
Path folder = p.getParent();