code: public int getScriptCount(File dir) {
  		int scripts = 0;
  		
  		for (ScriptType type : this.getScriptTypes()) {
  			File locDir = new File(dir, type.getName());
  			if (locDir.exists()) {
  				for (File f : locDir.listFiles()) {
  					String ext = f.getName().substring(f.getName().lastIndexOf(".") + 1);
  					String engineName = this.getEngineNameForExtension(ext);
  					if (engineName != null) {
  						scripts++;
  					}
  				}
  			}
  		}
  		return scripts;
  	}
docs: Gets the numbers of scripts for the given directory for the currently registered script engines and types.
  
  @param dir the directory to check.
  @return the number of scripts.
  @since 2.4.1