Deletes a file from the server.
Command line interface
Syntax
- $ rm filename
Arguments
- filename – (file) The file you wish to remove.
Example

Todo
- Add support for recursive delete
- Add support for multiple filenames
rm.php
- <?
- require("../plugin.php");
- if (is_ajax()) {
- if ($_POST["action"] == 'rm') {
- if (!file_exists($_POST['file'])) die("1");
- if (is_dir($_POST['file'])) die("2");
- die(@unlink($_POST['file']) ? "0" : "3");
- }
- exit;
- }
- ?>
- /**
- * Remove file
- **/
- TinyShell.plugins.rm = new Class({
- description: "Remove file",
- run : function(terminal, args) {
- this.t = terminal;
- if (args.length != 1) {
- terminal.print("rm: usage: rm filename");
- terminal.resume();
- } else {
- this.file = args[0];
- this.t.ajax_request(this.print, "<?php echo $_AJAX_URL?>", "action=rm&file="+encodeURIComponent(this.file));
- }
- },
- print: function(r) {
- if (r == "1") this.t.print("rm: file `"+this.file+"'; file does not exist");
- else if (r == "2") this.t.print("rm: file `"+this.file+"'; is a directory");
- else if (r == "3") this.t.print("rm: file `"+this.file+"'; permission denied");
- else this.t.print();
- this.t.resume();
- }
- });