dotnet-directory-files-utility 1.1.0

dotnet add package dotnet-directory-files-utility --version 1.1.0
                    
NuGet\Install-Package dotnet-directory-files-utility -Version 1.1.0
                    
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="dotnet-directory-files-utility" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="dotnet-directory-files-utility" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="dotnet-directory-files-utility" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add dotnet-directory-files-utility --version 1.1.0
                    
#r "nuget: dotnet-directory-files-utility, 1.1.0"
                    
#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.
#addin nuget:?package=dotnet-directory-files-utility&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=dotnet-directory-files-utility&version=1.1.0
                    
Install as a Cake Tool

Files Folders Utility

About | Technology | Installation | Configuration

NuGet GitHub Nuget

About

This is a utility to aid in directory management for .NET Web or .NET API applications and includes tools to conveniently look up physical and server paths based on mapped directories

Technology

.NET Standard 2.0

Installation

To install and use this tool, you will need to install the nuget package and register the service in your application settings.

Configuration

A good practice recommendation is to store the names of the directories you want to map in constants, so it will be easier to manage the directories later, for example.

public static class Consts
{
    public const string FilesFolder = "Files";
    public const string TempFolder = "Temp";
    public const string ImagesFolder = "Images";
}

After downloading and installing the package, you need to register the service to use it in your application, it is mandatory to add at least one directory in the mapping settings, in case of mapping subdirectories the name of the parent directory must always precede the name of the child directory as example to follow:

public void ConfigureServices(IServiceCollection services)
{
    services.RegisterDirectoriesFilesUtility(o =>
    {
        o.AddFolder(parent: Consts.FilesFolder, name: Consts.ImagesFolder);
        o.AddFolder(name: Consts.TempFolder);
        o.AddFolder(name: Consts.FilesFolder);
    });
}

Samples

After registering the service, you can use it like any other dependency injection in the context of your application, as shown in the following example.

public class HomeController : Controller
{
    private readonly ILogger<HomeController> _logger;
    private readonly IDirectoriesFilesUtility _utility;

    public HomeController(ILogger<HomeController> logger, IDirectoriesFilesUtility utility)
    {
        _utility = utility;
        _logger = logger;
    }

    public IActionResult Index()
    {
        HttpClient cli = new HttpClient();

        Stream sampleStream = cli
        .GetStreamAsync("https://images.pexels.com/photos/15476378/pexels-photo-15476378.jpeg")
        .Result;

        //you can omit the parameter if you want to get the directory only
        string destination = _utility.GetPath(Consts.FilesFolder, "sample.jpg");
        string source = _utility.GetPath(Consts.ImagesFolder, "sample.jpg");
        string sourceUrl = _utility.GetUrl(Consts.ImagesFolder, "sample.jpg");

        string streamName = _utility.WriteFile(sampleStream, source).Result;
        string copyName = _utility.CopyFile(source, destination);
        string moveName = _utility.MoveFile(source, destination);

        return View();
    }
}
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 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  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

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 131 6/26/2025
1.0.9 129 6/26/2025
1.0.8 196 3/8/2025
1.0.7 134 1/11/2025
1.0.6 284 7/30/2023
1.0.5 335 2/18/2023
1.0.4 328 2/5/2023

rollback minimal dependencies version for compatibility