Removes a directory from the server.
Command line interface
Syntax
- $ rmdir dirname
Arguments
- dirname – (directory) The folder you wish to delete.
Example

rmdir.php
- <?
- require("../plugin.php");
- if (is_ajax()) {
- if ($_POST["action"] == 'rmdir') {
- if (!is_dir($_POST['dir'])) die("1");
- if (count(glob($_POST['dir']."/*"))) die("2");
- die(@rmdir($_POST['dir']) ? "0" : "3");
- }
- exit;
- }
- ?>
- /**
- * Remove directory
- **/
- TinyShell.plugins.rmdir = new Class({
- description: "Remove directory",
- run : function(terminal, args) {
- this.t = terminal;
- if (args.length == 1) {
- this.dir = args[0];
- this.t.ajax_request(this.print, "<?php echo $_AJAX_URL?>", "action=rmdir&dir="+encodeURIComponent(this.dir));
- } else {
- terminal.print("rmdir: usage: rmdir dirname");
- terminal.resume();
- }
- },
- print: function(r) {
- if (r == "1") this.t.print("mkdir: directory `"+this.dir+"'; not a directory");
- else if (r == "2") this.t.print("mkdir: directory `"+this.dir+"'; directory not empty");
- else if (r == "3") this.t.print("mkdir: directory `"+this.dir+"'; permission denied");
- else this.t.print();
- this.t.resume();
- }
- });