Solved getting all yml files in a folder

Discussion in 'Plugin Development' started by vtg_the_kid, Feb 6, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    vtg_the_kid

    I searched online but I can't seem to figure out how to get all the yml files from a folder as an array. The folder is a File. It is confusing to me because first I need to make a FileConfiguration, then load it with YamlConfiguration.loadConfiguration(), so can someone please tell me how to get the yml files in a folder as an array? Thanks!
     
  2. Offline

    xTrollxDudex

    vtg_the_kid
    Loop through the File array of getDataFolder().listFiles() and see if the file name ends with a .yml, load that file.
     
    vtg_the_kid likes this.
  3. Offline

    Quackster

    If it's in another folder of your plugin folder you can do this.

    Code:
    for (File file : new File(plugin.getDataFolder().getAbsolutePath() + File.separator + "FOLDER NAME").listFiles()) {
     
    FileConfiguration conf = YamlConfiguration.loadConfiguration(file);
     
    vtg_the_kid likes this.
  4. Offline

    vtg_the_kid

  5. Offline

    TheLexoPlexx

    xTrollxDudex Quackster vtg_the_kid

    There is no getDataFolder() anymore (or I'm too stupid to find). I want to do this an I found this thread with google but I can't solve the Problem. Does getUpdaeFolder() does the same ? It sound really different.
     
  6. Offline

    xTrollxDudex

  7. Offline

    TheLexoPlexx

    Okay thank
     
Thread Status:
Not open for further replies.

Share This Page