2022-06-12 09:38:38 +02:00
|
|
|
import {Socket} from "socket.io";
|
|
|
|
function rmdir(args:Array<string>, curdir:any, socket:Socket):string {
|
|
|
|
var buf = "";
|
|
|
|
if (curdir[socket.id][args[0]] != undefined) {
|
|
|
|
if (typeof curdir[socket.id][args[0]] == "object") {
|
|
|
|
delete curdir[socket.id][args[0]];
|
|
|
|
buf += "Directory " + args[0] + " removed\n";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
buf += "Error: " + args[0] + " is not a directory\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
buf += "Error: " + args[0] + " does not exist\n";
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
export { rmdir };
|