code: public static String setDirectories(String content, String[] rules) {
  
          // get translation rules
          for (int i = 0; i < rules.length; i++) {
              String actRule = rules[i];
              // cut String "/default/vfs/" from rule
              actRule = CmsStringUtil.substitute(actRule, "/default/vfs", "");
              // divide rule into search and replace parts and delete regular expressions
              StringTokenizer ruleT = new StringTokenizer(actRule, "#");
              ruleT.nextToken();
              String search = ruleT.nextToken();
              int pos = search.lastIndexOf("(.*)");
              if (pos >= 0) {
                  search = search.substring(0, pos);
              }
              String replace = ruleT.nextToken();
              if (pos >= 0) {
                  replace = replace.substring(0, replace.lastIndexOf("$1"));
              }
              // scan content for paths if the replace String is not present
              if ((content.indexOf(replace) == -1) && (content.indexOf(search) != -1)) {
                  // ensure subdirectories of the same name are not replaced
                  search = "([}>\"'\\[]\\s*)" + search;
                  replace = "$1" + replace;
                  content = CmsStringUtil.substitutePerl(content, search, replace, "g");
              }
          }
          return content;
      }
docs: Translates directory Strings from OpenCms 4.x structure to new 5.0 structure.<p>
  
  @param content the filecontent
  @param rules the translation rules
  @return String the manipulated file content