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

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

Description

get Relative Path

License

LGPL

Declaration

public static String getRelativePath(File parent, File child) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.File;

public class Main {
    public static String getRelativePath(File parent, File child) {
        if (parent.isFile() || !child.getPath().startsWith(parent.getPath())) {
            return null;
        }/*from w w  w  .ja v a 2 s  .  c  om*/
        return child.getPath().substring(parent.getPath().length() + 1);
    }
}

Related

  1. getRelativePath(File fromFolder, File toFile)
  2. getRelativePath(File home, File f)
  3. getRelativePath(File home, File f)
  4. getRelativePath(File home, File f)
  5. getRelativePath(File original, File directory)
  6. getRelativePath(File parent, File child)
  7. getRelativePath(File parent, File f)
  8. getRelativePath(File parentDirectory, File file)
  9. getRelativePath(File path, File base)