code: private void setFolder(final StructrShellCommand parent, final Folder currentFolder, final String targetFolderName) throws IOException, FrameworkException {
  
  		final App app = StructrApp.getInstance();
  		String target = targetFolderName;
  
  		// remove trailing slash
  		if (target.endsWith("/")) {
  			target = target.substring(0, target.length() - 1);
  		}
  
  		if (target.startsWith("/")) {
  
  			final Folder folder = app.nodeQuery(Folder.class).and(StructrApp.key(Folder.class, "path"), target).sort(AbstractNode.name).getFirst();
  			if (folder != null) {
  
  				if (parent.isAllowed(folder, Permission.read, true)) {
  
  					parent.setCurrentFolder(folder);
  
  				} else {
  
  				term.println("Permission denied");
  				}
  
  			} else {
  
  				term.println("Folder " + target + " does not exist");
  			}
  
  		} else {
  
  			final Folder newFolder = parent.findRelativeFolder(currentFolder, target);
  			if (newFolder == null) {
  
  				term.println("Folder " + target + " does not exist");
  
  			} else {
  
  				if (parent.isAllowed(newFolder, Permission.read, true)) {
  
  					parent.setCurrentFolder(newFolder);
  
  				} else {
  
  					term.println("Permission denied");
  				}
  			}
  		}
  	}
docs: ----- private methods -----