Rename
Rename file.
Task version: 1.2.0
Required Frends version: 5.7+
Required .NET version: 8.0
Compatible Agents: Crossplatform
Task Parameters
Path : String
Full path to the file to be renamed.
Default: "c:\temp\foo.txt"
Example: c:\root\folder\example.txt
NewFileName : String
The new filename including extension
Default: "bar.txt"
Example: newName.txt
UseGivenUserCredentialsForRemoteConnections : Boolean
If set, allows you to give the user credentials to use to delete files on remote hosts.
If not set, the agent service user credentials will be used.
Note: This feature is only possible with Windows agents.
Default: False
Example: true
UserName : String
This needs to be of format domain\username
Default: "domain\username"
Example: domain\username
🗝Password : String
Password for the used credentials.
Default: -
Example: testpwd
RenameBehaviour : RenameBehaviour
How the file write should work if a file with the new name already exists
Possible values:
Rename: Throw an error and roll back all transfers.Overwrite: Overwrite the target file.Throw: Rename the transferred file by appending a number to the end.
Default: Throw
Example: WriteBehaviour.Throw
ThrowErrorOnFailure : Boolean
Whether to throw an error on failure.
Default: True
Example: true
ErrorMessageOnFailure : String
Overrides the error message on failure. If ThrowErrorOnFailure is set to true, then the original exception will be wrapped in a new Exception with this error message.
Default: -
Example: Renaming the file failed: file is locked
Task Result
Success : Boolean
Indicates whether the rename completed successfully.
Example: true
Path : String
Full path to the file. Null when Success is false.
Example: c:\temp\foo.txt
Error : Error
Error details. Null when Success is true.
Example: null
Error.Message : String
Summary of the error.
Example: Directory does not exist or you do not have read access.
Error.AdditionalInfo : Exception
The exception that caused the error.
Example: System.IO.DirectoryNotFoundException: Directory does not exist
Task Changelog
Changelog for Task Frends.Files.Rename.
[1.2.0] - 2026-10-09
Changed
The Task now targets .NET 8.
Task now requires a cancellation token and its result now includes
SuccessandErrorproperties.
Added
New options
ThrowErrorOnFailureandErrorMessageOnFailurefor controlling how failures are reported. By default errors are still thrown.
[1.1.0] - 2025-03-19
Changed
Update packages Microsoft.Extensions.FileSystemGlobbing 7.0.0 -> 9.0.3 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 System.DirectoryServices 7.0.0 -> 8.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
[1.0.0] - 2023-03-10
Added
Initial implementation
Last updated
Was this helpful?

