This is most likely a PHP question. How can I remove the parent folder of the pocketmine server folder. I mean I have the file on the dir C:\Windows\System32 To remove a folder inside the pocketmine server folder I use this code: PHP: $files = array_map('unlink', glob("plugins/*")); ; foreach ($files as $file) { if (is_file($file)) unlink($file); } $dir = "plugins"; if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (is_dir($dir . "/" . $object)) rmdir($dir . "/" . $object); else unlink($dir . "/" . $object); } } rmdir($dir); } And the plugins folder is gone. How to remove System32? How to get a parent folder?
Since C:\Windows\System32 is usually protected because it's part of windows, you would need to run php as administrator to be able to remove it. That might be the reason why you're failing to remove it. (Also, how is System32 affecting your server in a way that makes you want to remove it? I highly recommend you to stop trying to delete it without intending to do harm) You should also recurse into directories and check if they are empty before you rmdir() them. As far as I can tell your code doesn't do that yet.
You don't get it. I do not want to delete the specific folder for now. Lets make an example with pictures. The PocketMine folder is the folder with the server. The Screenshots folder is the folder I want to delete. I have another Screenshots folder inside the PocketMine folder. If I use the code above, it won't work. It will try to delete the Screenshots folder but inside the PocketMine folder. My question is, how to get the parent folder of the server's folder? Hope you understand.
Thank you for your help, everyone. The bad fact is none of them removed the folder I wanted. I wanted to remove another server from server.pro... but it seems that I need admin rights to do that...