TestableIO.System.IO.Abstractions.Extensions 22.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package TestableIO.System.IO.Abstractions.Extensions --version 22.0.1                
NuGet\Install-Package TestableIO.System.IO.Abstractions.Extensions -Version 22.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TestableIO.System.IO.Abstractions.Extensions" Version="22.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TestableIO.System.IO.Abstractions.Extensions --version 22.0.1                
#r "nuget: TestableIO.System.IO.Abstractions.Extensions, 22.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TestableIO.System.IO.Abstractions.Extensions as a Cake Addin
#addin nuget:?package=TestableIO.System.IO.Abstractions.Extensions&version=22.0.1

// Install TestableIO.System.IO.Abstractions.Extensions as a Cake Tool
#tool nuget:?package=TestableIO.System.IO.Abstractions.Extensions&version=22.0.1                

System.IO.Abstractions.Extensions NuGet Continuous Integration Renovate enabled

Convenience functionality on top of System.IO.Abstractions

dotnet add package TestableIO.System.IO.Abstractions.Extensions

Examples

CurrentDirectory extension

var fs = new FileSystem();

//with extension
var current = fs.CurrentDirectory();

//without extension
var current =  fs.DirectoryInfo.FromDirectoryName(fs.Directory.GetCurrentDirectory());

SubDirectory extension

var current = new FileSystem().CurrentDirectory();

//create a "temp" subdirectory with extension
current.SubDirectory("temp").Create();

//create a "temp" subdirectory without extension
current.FileSystem.DirectoryInfo.FromDirectoryName(current.FileSystem.Path.Combine(current.FullName, "temp")).Create();

File extension

var current = new FileSystem().CurrentDirectory();

//create a "test.txt" file with extension
using (var stream = current.File("test.txt").Create())
    stream.Dispose();

//create a "test.txt" file without extension
using (var stream = current.FileSystem.FileInfo.FromFileName(current.FileSystem.Path.Combine(current.FullName, "test.txt")).Create())
    stream.Dispose();

Automatic cleanup with Disposable extensions

Use CreateDisposableDirectory or CreateDisposableFile to create a IDirectoryInfo or IFileInfo that's automatically deleted when the returned IDisposable is disposed.

var fs = new FileSystem();

//with extension
using (fs.CreateDisposableDirectory(out IDirectoryInfo dir))
{
    Console.WriteLine($"This directory will be deleted when control leaves the using block: '{dir.FullName}'");
}

//without extension
var temp = fs.Path.GetTempPath();
var fileName = fs.Path.GetRandomFileName();
var path = fs.Path.Combine(temp, fileName);

try
{
    IDirectoryInfo dir = fs.Directory.CreateDirectory(path);
    Console.WriteLine($"This directory will be deleted in the finally block: '{dir.FullName}'");
}
finally
{
    fs.Directory.Delete(path, recursive: true);
}

IDirectoryInfo.CopyTo extension

var fs = new FileSystem();
var current = fs.CurrentDirectory();

//source
var source =  current.SubDirectory("source");
source.Create(); //make sure the source directory exists

//destination
var dest = current.SubDirectory("destination");

//copy
source.CopyTo(dest, recursive: true);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on TestableIO.System.IO.Abstractions.Extensions:

Repository Stars
recyclarr/recyclarr
Automatically sync TRaSH Guides to your Sonarr and Radarr instances
Version Downloads Last updated
22.0.3 825 3/1/2025
22.0.2 192 2/28/2025
22.0.1 95 2/28/2025
2.2.6 130 2/28/2025
2.2.5 49,727 3/8/2024
2.2.4 297 3/1/2024
2.2.3 379 2/27/2024
2.2.1 2,241 1/4/2024
2.1.3 1,975 12/24/2023
2.1.2 170 12/24/2023
2.1.1 364 12/10/2023
2.0.5 9,059 8/22/2023
2.0.4 165 8/20/2023
2.0.3 166 8/20/2023
2.0.2 171 8/19/2023
2.0.1 297 8/19/2023
1.0.43 1,302 8/8/2023
1.0.42 10,288 3/19/2023
1.0.41 230 3/19/2023
1.0.40 235 3/19/2023
1.0.39 5,541 12/16/2022
1.0.38 319 12/16/2022
1.0.37 313 12/16/2022
1.0.36 304 12/16/2022
1.0.35 314 12/16/2022
1.0.34 1,670 11/27/2022
1.0.32 8,603 4/1/2022
1.0.30 437 3/30/2022
1.0.28 469 3/12/2022
1.0.24 453 3/11/2022
1.0.23 458 3/11/2022
1.0.22 436 3/11/2022
1.0.21 456 3/11/2022
1.0.20 471 3/11/2022
1.0.19 431 3/11/2022
1.0.17 444 3/8/2022
1.0.16 439 3/8/2022
1.0.14 471 11/11/2021

2.0.0
- (Breaking) Moved all extensions methods to 'System.IO.Abstractions' namespace
- Added ThrowIfNotFound extension methods
- Removed .NET 5 build (should still work with .NET standard build)