public static String getCanonicalPathToParent(String path)
    {
	if(Common.notNullOrEmpty(path) && Common.isPathValid(path))
	{
	    if(Common.fileExist(path))
	    {
		File file = new File(path);
		String fileName = file.getName();

		if(Common.notNullOrEmpty(fileName))
		{
		    // Get the path to the parent directory.
		    return path.replace(File.separatorChar+fileName, "");
		}else { return null; }
	    }
	    else
	    {
		int indexOfLastSeperator = path.lastIndexOf(File.separatorChar);
		return path.substring(0,indexOfLastSeperator);
	    }
	}
	else { return null; }
    }