Solved Why wont this file create?

Discussion in 'Spigot Plugin Development' started by Azmidium, Mar 16, 2016.

  1. I am making a plugin which automatically (I like to say automagically) backs up worlds. I am getting an issue where the temporary folder and the zip file needed to be created wont create. This was working on my server and it still works, but I don't know why. I am gonna post the error, if you guys need the code, please specify what I need to grab around the errors as I want to keep the plugin as private as possible. Thank you! ;)

  2. We need to see the copy world class and backup loop specifically

    CopyWorld: lines 122 and 83
    BackupLoop: line 25

    And any other code relating to those lines
  3. Alright! here you go: ;)
    Code (Text):

    /* Line 83:*/ filesList(tempDir);
        private void filesList(File dir) {
            if (dir.exists()) {
     /*Line 123:/* File[] files = dir.listFiles();
            for (File file : files) {
                if (file.isFile())

    Code (Text):

              /*Line 25:8/  cw.initiate(worldName);
    #3 Azmidium, Mar 16, 2016
    Last edited: Mar 16, 2016
  4. Which lines are they? (Look at my previous post for the lines p)
  5. Updated :)
    Check out the post now ^^
  6. I would change "if (dir.exists()) {" to "if (!dir.exists)) {dir.mkdirs();}"
  7. I am getting this error:
    This is where the problem is occuring I think:
  8. Basically each time you copy a file to a new folder, you will need to create the new folders.
    Ex you copy folder plugins/Essentials to backups/plugins/Essestials.
    If none of those folders already exist in the backup folder, you will need to create them before you copy the files.
    Also if you are using Linux, make sure you have write access to those folders.
  9. I already check if both of those files exist, this is why I went to the forums. ;)
    Here is the error:
  10. I think see the bug now, are you naming your files "2016-03-15 20:00:06.547"?
    If this is the case, the problems is the colons. There are a few certain characters you can not use in file names.
    \ / : * ? < > |
    Obviously the slashes will work for separating directories but you cant use colons in file names.
    I would do something like YYYY_MM_DD-HH_MM
    • Agree Agree x 1
  11. Thanks so much for helping me out man! <3
    Good to know! Is there anything I can do to repay you?
  12. No problem, just helping out.
  13. Alright!