FileSnap 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package FileSnap --version 1.0.2                
NuGet\Install-Package FileSnap -Version 1.0.2                
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="FileSnap" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FileSnap --version 1.0.2                
#r "nuget: FileSnap, 1.0.2"                
#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 FileSnap as a Cake Addin
#addin nuget:?package=FileSnap&version=1.0.2

// Install FileSnap as a Cake Tool
#tool nuget:?package=FileSnap&version=1.0.2                

FileSnap

FileSnap is a .NET library designed to capture, compare, and restore file system snapshots. It allows you to take snapshots of a file system at a given point in time, record file and directory states (including metadata such as file sizes, timestamps, and attributes), compare different snapshots to identify changes (new, modified, or deleted files), and restore file system states to a previous snapshot. This library is useful for scenarios such as backup, security, auditing, file integrity monitoring, and implementing versioned file systems or system restore capabilities.

Features

  • Capture Snapshots: Record the state of files and directories, including metadata and content.
  • Compare Snapshots: Identify changes between snapshots, including new, modified, and deleted files.
  • Restore Snapshots: Restore file system states to a previous snapshot, including file content and metadata.
  • Optimized Storage: Uses compression to minimize storage space for snapshots.
  • Cross-Platform: Compatible with Windows, macOS, and Linux.

Installation

To install FileSnap, add the following package to your .NET project:

dotnet add package FileSnap

Usage

Capturing a Snapshot

using FileSnap.Core.Services;

var snapshotService = new SnapshotService(new HashingService());
var snapshot = await snapshotService.CaptureSnapshotAsync("path/to/directory");
await snapshotService.SaveSnapshotAsync(snapshot, "path/to/save/snapshot.fsnap");

Loading and Comparing Snapshots

var snapshotService = new SnapshotService(new HashingService());
var beforeSnapshot = await snapshotService.LoadSnapshotAsync("path/to/before/snapshot.fsnap");
var afterSnapshot = await snapshotService.LoadSnapshotAsync("path/to/after/snapshot.fsnap");

var comparisonService = new ComparisonService();
var differences = comparisonService.Compare(beforeSnapshot, afterSnapshot);

Restoring a Snapshot

var snapshotService = new SnapshotService(new HashingService());
var snapshot = await snapshotService.LoadSnapshotAsync("path/to/snapshot.fsnap");

var restorationService = new RestorationService();
await restorationService.RestoreSnapshotAsync(snapshot, "path/to/restore/directory");

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

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.0.6 81 12/2/2024
1.0.5 77 12/2/2024
1.0.4 78 12/2/2024
1.0.2 78 12/1/2024
1.0.1 79 11/30/2024