Creates a folder in the current working directory on the server.
Command line interface
Syntax
- $ mkdir [-m mode] dirname
Arguments
- mode – (octal number, optional) The mode. Default: 0755. Ignored on Windows servers.
- dirname – (string) Decided directory name.
Example

mkdir.php
- <?
- require("../plugin.php");
- if (is_ajax()) {
- if ($_POST["action"] == 'mkdir') {
- if (file_exists($_POST['dir'])) die("1");
- die(@mkdir($_POST['dir'], $_POST['mode']) ? "0" : "2");
- }
- exit;
- }
- ?>
- /**
- * Make directory
- **/
- TinyShell.plugins.mkdir = new Class({
- description: "Create new directory",
- run : function(terminal, args) {
- this.t = terminal;
- if (args.length == 1 || (args.length == 3 && args[0] == "-m")) {
- this.mode = "0755";
- this.dir = args[0];
- if (args[0] == "-m") {
- this.mode = args[1];
- this.dir = args[2];
- }
- this.t.ajax_request(this.print, "<?php echo $_AJAX_URL?>", "action=mkdir&dir="+encodeURIComponent(this.dir)+"&mode="+encodeURIComponent(this.mode));
- } else {
- terminal.print("mkdir: usage: mkdir [-m mode] dirname");
- terminal.resume();
- }
- },
- print: function(r) {
- if (r == "1") this.t.print("mkdir: failed to create directory `"+this.dir+"'; file exists\n");
- else if (r == "2") this.t.print("mkdir: failed to create directory `"+this.dir+"'; permission denied\n");
- else this.t.print();
- this.t.resume();
- }
- });