/// <summary> /// Deletes a file or directory /// </summary> /// <param name="brickDirectoryPath">The relative path, must start with ../ and end with /</param> /// <param name="recursive">if true deletes the directory and all its contents</param> /// <returns><c>true</c> if deleted otherwise <c>false</c></returns> public static async Task <bool> DeleteDirectory(string brickDirectoryPath, bool recursive = false) { brickDirectoryPath = Firmware.FileSystem.ToBrickDirectoryPath(brickDirectoryPath); if (recursive) { DirectoryContent content = await GetDirectoryContent(brickDirectoryPath); foreach (File file in content.Files) { await DeleteFile(file.Path); } foreach (Directory directory in content.Directories) { await DeleteDirectory(directory.Path, recursive); } } return(await SystemMethods.Delete(Brick.Socket, brickDirectoryPath)); }
/// <summary> /// Deletes this file /// Use with care!! /// </summary> public async Task <bool> Delete() { return(await SystemMethods.Delete(Brick.Socket, FilePath)); }
/// <summary> /// Deletes a file /// </summary> /// <param name="brickFilePath">The relative path, must start with ../</param> /// <returns><c>true</c> if deleted otherwise <c>false</c></returns> public static async Task <bool> DeleteFile(string brickFilePath) { return(await SystemMethods.Delete(Brick.Socket, brickFilePath)); }