I work with directories and files in Linux. For example, I have the following piece of code:
File f = new File("/media/yevhenii/Local disk D/Books"); System.out.println(f.getAbsolutePath()); The result is a full path, like "/ media / yevhenii / Local disk D / Books". How can one separate the first two catalogs (ie / media / yevhenii /) from the steel part? I thought through substring (), but if I have a different path (for example / media / yevhenii / Local disk D / Books / Books2) then substring () will work crookedly. Those. the point is that for any length of paths the first two directories are deleted. Thank you in advance.