Frends.Files.LocalBackup / 4.0.0
Summary
Copies files into a backup directory, optionally one subdirectory per run so successive runs do not overwrite each other, and can prune directories older than a given age.
Typical use — keeping a safety copy of what a Process consumed, with retention handled in the same step
- Upgraded the task to .NET 8.
- Breaking Standardize pattern matching logic between tasks.
- Clarified relative input matching rules: patterns are evaluated relative to the source directory, matching is case-insensitive, glob mode supports * and **, and <regex> enables regex evaluation against the relative path and file name.
- File names with round and square brackets are now backed up correctly.
Breaking File masks containing regex special characters (like brackets, parentheses, pipes etc.) are now treated as literal file names by default.
To use regex syntax, add the
Before: test.(txt|xml) regex (matches test.txt or test.xml) invoice[2024].pdf regex (matches invoice2.pdf etc.)
After:
test.(txt|xml) literal (matches file named "test.(txt|xml)")
- Update packages: System.ComponentModel.Annotations 4.7.0 -> 5.0.0 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.6.1 -> 17.13.0 MSTest.TestAdapter 2.2.7 -> 3.8.3 MSTest.TestFramework 2.2.8 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0
- Fixed how FilePaths were handled. Changed casting to string[] to convert the object into a string[] by casting it first as a object[].
- Fixed bug in CreateBackup which was caused by Task not been able to delete the directory if there are directories present.
- Added check for implicit match for the file and filemask.
- Added parameter for FilePaths. If FilePaths is used it will overwrite the SourceDirectory and SourceFile parameters.
- Fixed issue where Cleanup adds deleted message even if files were not deleted.
- Fixed issue when using CreateSubdirectories Cleanup uses same directory which is created in Backup and when there's no files to backup the directory is deleted and cleanup won't find the directory.
- Cleanup will clean individual files in addition to directories when CreateSubdirectories is false.
- Added CreateSubdirectories input which gives the user an option to choose whether to create a backup into a given (BackupDirectory) or create a new folder with a name generated by task into (BackupDirectory).
- Cleanup change: Directory to be deleted is determined by timestamp in directory name when (CreateSubdirectories) is true, else by directory's LastWriteTime value.
- Modified the task to use #process.executionid instead of a random guid
- Breaking Added input for TaskExecutionId as guid
- Added backup directory value to Result object
- Added file count how many were made backup of
- Breaking Removed BackupObject class and changed the result object to have list of string for backup and cleanup
- Initial implementation