1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How can I make File inside Folder

Discussion in 'Development' started by Hoyee, Dec 30, 2020.

  1. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    For example, I want to make a Folder named "Diamond", and create Stone.yaml inside Diamond Folder(with mkdir)

    How can?
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    PHP:

    if(!is_dir($this->getDataFolder() . "blocks")) {
                
    mkdir($this->getDataFolder() . "blocks"); // Getting the data folder
            
    }
            
    $this->saveConfig();
            
    $this->saveResource("blocks" DIRECTORY_SEPARATOR "stone.yml");
     
  3. Hoyee

    Hoyee Baby Zombie

    Messages:
    126
    Then How can I create "Item" Folder before creating "blocks"?

    and if "Item" Folder is already created, How can I create "blocks" folder inside "Item" folder.

    like Item\blocks\stone.yml
     
  4. OguzhanUmutlu

    OguzhanUmutlu Witch

    Messages:
    63
    GitHub:
    OguzhanUmutlu
    PHP:
    if(!is_dir($this->getDataFolder() . "Item")) {
      
    mkdir($this->getDataFolder() . "Item");
    }
    if(!
    is_dir($this->getDataFolder() . "Blocks")) {
      
    mkdir($this->getDataFolder() . DIRECTORY_SEPARATOR."Item".DIRECTORY_SEPARATOR"Blocks");
    }
    $this->saveConfig();
    $this->saveResource("Item" DIRECTORY_SEPARATOR ."Blocks".DIRECTORY_SEPARATOR "stone.yml");
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.