code: public static String getName(String resource) {
  
          if ("/".equals(resource)) {
              return "/";
          }
          // remove the last char, for a folder this will be "/", for a file it does not matter
          String parent = (resource.substring(0, resource.length() - 1));
          // now as the name does not end with "/", check for the last "/" which is the parent folder name
          return resource.substring(parent.lastIndexOf('/') + 1);
      }
docs: Returns the name of a resource without the path information.<p>
  
  The resource name of a file is the name of the file.
  The resource name of a folder is the folder name with trailing "/".
  The resource name of the root folder is <code>/</code>.<p>
  
  Example: <code>/system/workplace/</code> has the resource name <code>workplace/</code>.
  
  @param resource the resource to get the name for
  @return the name of a resource without the path information