public static String makeRelativePath(File parent, File child)
	{
		String parentPath = parent.getAbsolutePath();
		String childPath = child.getAbsolutePath();

		int len = Math.min(parentPath.length(), childPath.length());
		
		int differenceCharIndex;
		for (differenceCharIndex = 0; differenceCharIndex < len; differenceCharIndex++) 
		{
			if (parentPath.charAt(differenceCharIndex) != childPath.charAt(differenceCharIndex))
				break;
		}
		
		if (differenceCharIndex == 0)
			return childPath;
		
		String childSubPath = childPath.substring(differenceCharIndex);
		String parentSubPath = parentPath.substring(differenceCharIndex);
		
		int parentSubFoldersCount = 0;
		for (int chrIndex = 0; chrIndex < parentSubPath.length(); chrIndex++) 
		{
			if (parentSubPath.charAt(chrIndex) == File.separatorChar)
				parentSubFoldersCount++;
		}
		if (parentSubPath.length() > 0)
			parentSubFoldersCount++;
		
		StringBuilder result = new StringBuilder();
		for (int i = 0; i < parentSubFoldersCount; i++) 
		{
			result.append(".." + File.separatorChar);
		}
		if (childSubPath.startsWith(File.separator))
			childSubPath = childSubPath.substring(1);
		
		result.append(childSubPath);
		return result.toString();
	}