Skip to content

Command line application to allow the user to list and delete generations of files in a Windows File History archive folder.

License

Notifications You must be signed in to change notification settings

RedFiveCode/FileHistory

Repository files navigation

FileHistoryApp

Introduction

Windows 10 has a file history/backup feature whereby generations of files in selected folders are archived to a destination folder or drive. See https://support.microsoft.com/en-us/windows/file-history-in-windows-5de0e203-ebae-05ab-db85-d5aa0a199255

Windows has an existing graphical feature to allow the users to review and restore selected archived files.

This application allows the user to list and delete generations of files in an archive folder. The archive folder does not have to be that belonging to the current PC or user. Unlike the Windows feature, it is not restricted to viewing the current user's archive or risking changes to the current archive configuration.

Possible operations are:

  • list file generations; can filter files, optionally recurse sub-folders
  • delete old file generations; can optionally filter files, keep the last N generations and preview file names before deletion

Background

This application arose as I had several instances of FileHistory backups from several old PCs and users accumulated over time. The goal was to provide a consolidated view of each archive and so reduce the required disc space by deleting older generations of each file.

Technical

This is a command line application written in C# for the .net framework version 4.8.

It uses the following nuget packages/files:

Includes unit tests (MSTest).

Examples

Command line help is available:

FileHistory --help
  show       (Default Verb) Show file history files
  tidy       Tidy old file history files
  help       Display more information on a specific command.
  version    Display version information.

The list command is to find and display old generations of matching files in the specified folder:

FileHistory list --help
  -h, --hide           Hide display of files with only one generation (and no history).
  -f, --folder         Required. Input folder.
  -r, --recurse        Recurse sub-folders.
  -m, --match          Filter using filename wildcard (case insensitive).
  -g, --minimumSize    Filter to include files greater than minimum size.
  -v, --verbose        Set output to verbose messages.
  --help               Display this help screen.
  --version            Display version information.

The tidy command is to delete old versions of matching files in the specified folder:

FileHistory tidy --help
  -p, --preview                  Preview, do not delete files.
  -k, --keepRecentGenerations    (Default: 1) Keep the most recent N generations
  -f, --folder                   Required. Input folder.
  -r, --recurse                  Recurse sub-folders.
  -m, --match                    Filter using filename wildcard (case insensitive).
  -g, --minimumSize              Filter to include files greater than minimum size.
  -v, --verbose                  Set output to verbose messages.
  --help                         Display this help screen.
  --version                      Display version information.

Testing

Tested with Windows 10 Professional version 20H2. Includes unit tests.

Security considerations

Enumerates files and folders. Display file name, path and timestamp information. Deletes files.

Author and License

RedFiveCode (https://github.com/RedFiveCode)

Copyright (c) 2021-2023 RedFiveCode (https://github.com/RedFiveCode) All rights reserved.

Released under MIT License (see License.txt file).

Acknowledgments

Windows is a trademark of the Microsoft group of companies.

About

Command line application to allow the user to list and delete generations of files in a Windows File History archive folder.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages