SyntaxFix
Write A Post
Hire A Developer
Questions
String parentPath = f.getPath().substring(0, f.getPath().length() - f.getName().length());
This would be my solution