Solved Testing, if a file exists

Discussion in 'Plugin Development' started by Max8801, Sep 6, 2015.

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

    Max8801

    Hello,
    I am writing a little clan plugin. I have to test if a specific file already exists in the plugin's datafolder.
    Please help!
    Regards, Max.
     
  2. Online

    timtower Administrator Administrator Moderator

    Max8801 likes this.
  3. @Max8801 As @timtower said, check if a file exists with:
    Code:
    if(file.exists()) {
              //do something
    
    }
    
    If you do not have a file object, you should create one(basic Java...):
    Code:
    File file = new File("C:/Users/<Your_Name>/<Directory>");
    
    Hope this helps!
     
    Max8801 likes this.
  4. Offline

    Max8801

    Thank you for your answers! It solved my problem!
     
Thread Status:
Not open for further replies.

Share This Page