private void validateDirectory()
  {
    char end = directory.charAt(directory.length() - 1);
    if (end != '/' && end != '\\') 
      directory = directory + '/';
    File directoryFile = new File(directory);
    if (!directoryFile.exists())
      directoryFile.mkdirs();
  }