LocalBackup
Create a local backup. Optionally task can create new subdirectories for backups and delete old backup directories.
Task version: 3.0.0
Required Frends version: 5.1+
Required .NET version: 471, 6.0, standard2.0
Compatible Agents: Legacy, Crossplatform
Task Parameters
SourceDirectory : String
Source directory.
Default: -
Example: c:\temp
SourceFile : String
Source file. Supports wildcards (* and ?) and regular expressions.
Use prefix for advanced regex patterns. Without the prefix,
the mask is treated literally (safe for file names with brackets etc.).
Default: -
Example: Literal/wildcard: test.txt, test*.txt, test?.txt, invoice(2024).pdf Regex: test.(txt|xml), test.[^t][^x][^t], ^(?!prof).*_test.txt
FilePaths : Object
The paths to the files to be backuped, mainly meant to be used with the file trigger with the syntax: #trigger.data.filePaths
FilePaths will overwrite SourceDirectory and SourceFile parameters.
Default: -
Example: #trigger.data.filePaths
BackupDirectory : String
Destination directory where backup folder will be created. Backup directory's format if CreateSubdirectories=true: {BackupDirectory}{timestamp}-{Guid}.
Default: -
Example: c:\temp\backups, c:\temp\backups</code>
CreateSubdirectories : Boolean
Create a subdirectory into the given backup directory.
Default: True
Example: true
TaskExecutionId : String
Enabled when (Create Subdirectories) is true. Value which is used in naming the backup directory. Can be any string but using task's execution id as default to avoid duplicate directory names.
Default: #process.executionid
Example: e7e34166-f4fd-45e5-9307-ea5c2cf8e037, foobar123
Cleanup : Boolean
Cleanup older than {DaysOlder} folders from backup directory.
If Create Subdirectories is false, individual files will also get cleaned.
Default: -
Example: false
DaysOlder : Int32
Clean up backups older than given value in days. Enabled when {Cleanup} is true.
Default: -
Example: 30
Task Result
Directory : String
Backup directory.
Example: C:\directory\backup\2022-07-07_08_51_02-e7e34166-f4fd-45e5-9307-ea5c2cf8e037
FileCountInBackup : Int32
Count of files which were copied to backup directory.
Example: 1
Backups : List<String>
Backup results as list of strings.
Example: "Backups": [ "Backup complete: C:\test\localbackup\test - Copy (2).txt to C:\test\backup\2022-07-07_08_51_02-e7e34166-f4fd-45e5-9307-ea5c2cf8e037\test - Copy (2).txt", "Backup complete: C:\test\localbackup\test - Copy (3).txt to C:\test\backup\2022-07-07_08_51_02-e7e34166-f4fd-45e5-9307-ea5c2cf8e037\test - Copy (3).txt" ]
Cleanups : List<String>
Cleanup results as list of strings.
Example: "Cleanups: [ "C:\test\backup\2022-07-11_05_44_41-ab214387-98f0-44de-8ec5-16ba01b8ab97 deleted.", "C:\test\backup\2022-06-25_06_23_56-ab214387-98f0-44de-8ec5-16ba01b8ab97 deleted." ]
Task Changelog
Changelog for Task Frends.Files.LocalBackup.
[3.0.0] - 2026-08-03
Fixed
File names with round and square brackets are now backed up correctly.
Changed
BREAKING CHANGE: 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 prefix to your mask.
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)") test.(txt|xml) regex (matches test.txt or test.xml) invoice[2024].pdf literal (matches file named "invoice[2024].pdf")
[2.2.0] - 2025-03-19
Changed
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
[2.1.3] - 2024-01-16
Fixed
Fixed how FilePaths were handled. Changed casting to string[] to convert the object into a string[] by casting it first as a object[].
[2.1.2] - 2023-08-31
Fixed
Fixed bug in CreateBackup which was caused by Task not been able to delete the directory if there are directories present.
[2.1.1] - 2023-08-08
Fixed
Added check for implicit match for the file and filemask.
[2.1.0] - 2023-05-31
Added
Added parameter for FilePaths. If FilePaths is used it will overwrite the SourceDirectory and SourceFile parameters.
[2.0.4] - 2023-05-09
Fixed
Fixed issue where Cleanup adds deleted message even if files were not deleted.
[2.0.3] - 2022-11-25
Fixed
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.
[2.0.2] - 2022-10-13
Changed
Cleanup will clean individual files in addition to directories when CreateSubdirectories is false.
[2.0.1] - 2022-09-13
Added
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).
Changed
Cleanup change: Directory to be deleted is determined by timestamp in directory name when (CreateSubdirectories) is true, else by directory's LastWriteTime value.
[2.0.0] - 2022-07-11
Added
Modified the task to use #process.executionid instead of a random guid
[Breaking change] Added input for TaskExecutionId as guid
Added backup directory value to Result object
Added file count how many were made backup of
[Breaking change] Removed BackupObject class and changed the result object to have list of string for backup and cleanup
[1.0.0] - 2022-05-16
Added
Initial implementation
Last updated
Was this helpful?

