Java Path Relative Get getRelativePath(File dir, File child)

Here you can find the source of getRelativePath(File dir, File child)

Description

Get relative path from two absolute paths.

License

Open Source License

Declaration

public static String getRelativePath(File dir, File child) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**/* w w w . j  a  v a  2  s.  c om*/
     * Get relative path from two absolute paths.
     * 
     * @return
     */
    public static String getRelativePath(File dir, File child) {
        return dir.getAbsoluteFile().toURI().relativize(child.getAbsoluteFile().toURI()).getPath();
    }
}

Related

  1. getRelativePath(File baseDir, File subFile, String seperator)
  2. getRelativePath(File baseFile, File file)
  3. getRelativePath(File baseFolder, File subject)
  4. getRelativePath(File child, File directory)
  5. getRelativePath(File currentDir, File target)
  6. getRelativePath(File dir, File file)
  7. getRelativePath(File f, File base)
  8. getRelativePath(File file)
  9. getRelativePath(File file, File basedir)