Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved how to delete a world folder?

Comments in 'Plugin Development' started by TryoneLegendZzz, Nov 7, 2015.

  1. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    any help?
  2. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    TryoneLegendZzz likes this.
  3. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
  4. TheMaks
    Offline

    TheMaks Active Member

    Joined:
    Jul 19, 2015
    Posts:
    58
    Minecraft User:
    TheMaks
    PHP:
    $name "world";
    $level $this->getServer()->getDataPath()."/worlds/".$name;
    unlink($level);
    thebigsmileXD and iDirtPlayzMC like this.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you bother to find the link for the unlink() function, why not bother to read the user-contributed comments as well?
    http://php.net/manual/en/function.unlink.php#109971
    http://php.net/manual/en/function.unlink.php#87045
    http://php.net/manual/en/function.rmdir.php
    http://php.net/manual/en/function.rmdir.php#98622
    (Summary: You cannot use unlink() or rmdir() to delete a directory that is not empty!)

    Or if you are using a private plugin that is only expected to be run on Linux or OS X, you can simply:
    PHP:
    exec("rm -r " escapeshellarg(realpath($this->getServer()->getDataPath() . "worlds/" $name)));
    Gamecrafter and Praxthisnovcht like this.
  6. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    then how can i delete a world folder? or rename it?
  7. Praxthisnovcht
    Offline

    Praxthisnovcht Notable Member Plugin Developer

    Joined:
    Mar 10, 2014
    Posts:
    699
    Plugins:
    4
    Minecraft User:
    PraxHellTag
    it's pretty much the same question. but I use unlink to delete region of world

Share This Page

Advertisement