Soenneker.Extensions.FileInfo 4.0.612

Prefix Reserved
dotnet add package Soenneker.Extensions.FileInfo --version 4.0.612
                    
NuGet\Install-Package Soenneker.Extensions.FileInfo -Version 4.0.612
                    
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="Soenneker.Extensions.FileInfo" Version="4.0.612" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Extensions.FileInfo" Version="4.0.612" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Extensions.FileInfo" />
                    
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 Soenneker.Extensions.FileInfo --version 4.0.612
                    
#r "nuget: Soenneker.Extensions.FileInfo, 4.0.612"
                    
#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.
#:package Soenneker.Extensions.FileInfo@4.0.612
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Extensions.FileInfo&version=4.0.612
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Extensions.FileInfo&version=4.0.612
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Extensions.FileInfo

Checks and removes System.IO.FileAttributes flags through FileInfo.

Installation

dotnet add package Soenneker.Extensions.FileInfo

Check attributes

using System.IO;
using Soenneker.Extensions.FileInfo;

var file = new FileInfo("report.csv");

bool protectedOrArchived = file.HasReadOnlyOrArchivedAttribute();
bool both = file.HasAttributeSet(FileAttributes.ReadOnly | FileAttributes.Archive);

HasReadOnlyOrArchivedAttribute() returns true when either flag is present. HasAttributeSet() requires every requested flag to be present. Passing 0 to HasAttributeSet() returns true, following normal bitmask semantics.

Reading FileInfo.Attributes accesses filesystem metadata and can throw when the path is missing, inaccessible, or unsupported by the platform.

Remove attributes

file.RemoveReadOnlyOrArchivedAttribute();

// Or remove a specific combination:
file.RemoveAttribute(FileAttributes.ReadOnly | FileAttributes.Hidden);

Both methods modify the file’s attributes on disk. RemoveAttribute() does nothing when none of the requested flags are present; after a write it refreshes the FileInfo metadata. Filesystem access, permission, and platform exceptions propagate to the caller.

RemoveAttribute() accepts any FileAttributes flags, not only cosmetic flags. Avoid removing structural or platform-specific flags unless that is explicitly intended.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Extensions.FileInfo:

Package Downloads
Soenneker.Utils.FileSync

A utility library encapsulating synchronous file IO operations

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.612 121 8/30/2026
4.0.611 94 8/29/2026
4.0.610 443 7/27/2026
4.0.609 251 7/16/2026
4.0.608 1,442 6/18/2026
4.0.607 334 6/5/2026
4.0.606 357 4/22/2026
4.0.605 396 3/12/2026
4.0.604 193 3/12/2026
4.0.603 183 3/12/2026
4.0.602 223 3/12/2026
4.0.601 238 3/10/2026
4.0.600 231 3/9/2026
4.0.599 128 3/9/2026
4.0.598 178 3/9/2026
4.0.597 216 3/4/2026
4.0.596 534 1/8/2026
4.0.595 275 1/2/2026
4.0.594 660 11/20/2025
4.0.593 381 10/29/2025
Loading failed

Improve file attribute documentation