code: public SftpFile getParent() throws SshException, SftpStatusException {
  
  		if (absolutePath.lastIndexOf('/') == -1) {
  			// This is simply a filename so the parent is the users default
  			// directory
  			String dir = sftp.getDefaultDirectory();
  			return sftp.getFile(dir);
  
  		}
  		// Extract the filename from the absolute path and return the parent
  		String path = sftp.getAbsolutePath(absolutePath);
  
  		if (path.equals("/"))
  			return null;
  
  		// If we have . or .. then strip the path and let getParent start over
  		// again with the correct canonical path
  		if (filename.equals(".") || filename.equals("..")) {
  			return sftp.getFile(path).getParent();
  		}
  		int idx = path.lastIndexOf('/');
  
  		String parent = path.substring(0, idx);
  
  		// Check if we at the root if so we will have to add /
  		if (parent.equals(""))
  			parent = "/";
  
  		return sftp.getFile(parent);
  
  	}
docs: Get the parent of the current file. This method determines the correct
  path of the parent file; if no parent exists (i.e. the current file is
  the root of the filesystem) then this method returns a null value.
  
  @return SftpFile
  @throws SshException
  @throws SftpStatusException