File.Delete
Skip to content
mnscript
StringResult File.Delete(string, string) 

Description ​

Deletes a file in a directory.

Arguments ​

string - The directory to search.
string - The file to delete.

Returns ​

StringResult - A StringResult representing the success/failure of the operation.

Example ​

msc
using File;
using Console;
using System;

// Deletes "bf_password.exe" in "r/programs".

StringResult result = File.Delete("r/programs", "bf_password.exe");

if(result.GetResult()){
    Console.WriteLine("The file was deleted!");
}else{
    // If the file could not be deleted, the result string contains the reason.
    Console.WriteLine("Error: "..result.GetString());
}