> For the complete documentation index, see [llms.txt](https://docs.frends.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.frends.com/tasks/tasks/files/move.md).

# Move

Move files.

Task version: 3.0.0

Required Frends version: 5.7+

Required .NET version: 8.0

Compatible Agents: Crossplatform

Source code: <https://github.com/FrendsPlatform/Frends.Files/tree/main/Frends.Files.Move>

## Task Parameters

{% tabs %}
{% tab title="Input" %}

| Name                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SourceDirectory : `String` | <p>Source directory.</p><p><br>Default: <code>-</code><br>Example: <code>c:\temp</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Pattern : `String`         | <p>Pattern to match relative to SourceDirectory. Matching is case-insensitive and separators are normalized to /. For regex mode, prefix the pattern with and the matcher checks the full relative path and filename. For wildcard mode, \* and \*\* work as glob operators and regex special characters are treated literally.</p><p><br>Default: <code>"</code><strong><code>\Folder\*.xml"</code></strong><br><strong>Example:</strong> <code>/Folder/</code><em><code>.xml, Folder/</code></em><code>.txt, report-</code><em><code>.csv, ^(?!prof).</code></em><code>\_test.txt</code></p> |
| TargetDirectory : `String` | <p>Target directory where the found files should be copied to</p><p><br>Default: <code>"d:\backup"</code><br>Example: <code>\183.169.59.122\Shared\dst</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                              |
| {% endtab %}               |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

{% tab title="Connection" %}

| Name                        | Description                                                                                                                                                                                         |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SourceIsRemote : `Boolean`  | <p>Defines if the source path is on a remote host.</p><p>Note: This feature is only possible with Windows agents.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>          |
| SourceUserName : `String`   | <p>Username used to connect with remote source</p><p>NOTE: This needs to be of format domain\username</p><p><br>Default: <code>"domain\username"</code><br>Example: <code>WORKGROUP\John</code></p> |
| 🗝SourcePassword : `String` | <p>Password for the used credentials.</p><p><br>Default: <code>-</code><br>Example: <code>test</code></p>                                                                                           |
| TargetIsRemote : `Boolean`  | <p>Defines if the target path is on a remote host.</p><p>Note: This feature is only possible with Windows agents.</p><p><br>Default: <code>False</code><br>Example: <code>false</code></p>          |
| TargetUserName : `String`   | <p>Username used to connect with remote target</p><p>NOTE: This needs to be of format domain\username</p><p><br>Default: <code>"domain\username"</code><br>Example: <code>WORKGROUP\John</code></p> |
| 🗝TargetPassword : `String` | <p>Password for the used credentials.</p><p><br>Default: <code>-</code><br>Example: <code>test</code></p>                                                                                           |
| {% endtab %}                |                                                                                                                                                                                                     |

{% tab title="Options" %}

| Name                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ThrowErrorOnFailure : `Boolean`         | <p>Whether to throw an error on failure.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ErrorMessageOnFailure : `String`        | <p>Overrides the error message on failure.</p><p><br>Default: <code>-</code><br>Example: <code>Custom error message</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| PreserveDirectoryStructure : `Boolean`  | <p>If set, will recreate the directory structure from the SourceDirectory under the DestinationDirectory for copied files</p><p><br>Default: <code>False</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| CreateTargetDirectories : `Boolean`     | <p>If set, will create the target directory if it does not exist,</p><p>as well as any subdirectories if PreserveDirectoryStructure is set.</p><p><br>Default: <code>True</code><br>Example: <code>true</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| IfTargetFileExists : `FileExistsAction` | <p>What should happen if a file with the same name already exists in the target directory.</p><p>\* Throw - Throw an error and roll back all transfers</p><p>\* Overwrite - Overwrites the target file</p><p>\* Rename - Renames the transferred file by appending a number to the end</p><p>Possible values:</p><ul><li><code>Throw</code>: Throw an error and roll back all transfers.</li><li><code>Overwrite</code>: Overwrite the target file.</li><li><code>Rename</code>: Rename the transferred file by appending a number to the end.</li></ul><p><br>Default: <code>Throw</code><br>Example: <code>FileExistsAction.Overwrite</code></p> |
| {% endtab %}                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| {% endtabs %}                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

## Task Result

| Name                               | Description                                                                                                                                                                                                                                                                             |
| ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Success : `Boolean`                | <p>Indicates if the task completed successfully.<br>Example: <code>true</code></p>                                                                                                                                                                                                      |
| Error : `Error`                    | <p>Error that occurred during task execution.<br>Example: <code>object { string Message, Exception AdditionalInfo }</code></p>                                                                                                                                                          |
| Error.Message : `String`           | <p>Summary of the error.<br>Example: <code>Access denied to source directory.</code></p>                                                                                                                                                                                                |
| Error.AdditionalInfo : `Exception` | <p>Additional information about the error.<br>Example: <code>object { Exception AdditionalInfo }</code></p>                                                                                                                                                                             |
| Files : `List<FileItem>`           | <p>List of FileItem objects with source path and target path attributes.<br>Example: <code>\[object {SourcePath: C:\test\testfolder\test1.txt, TargetPath: C:\test\moved\test1.txt}, object {SourcePath: C:\test\testfolder\test2.txt, TargetPath: C:\test\moved\test2.txt}]</code></p> |

## Task Changelog

Changelog for Task Frends.Files.Move.

### \[3.0.0] - 2026-09-10

#### Changed

* Upgraded the task to .NET 8.
* \[Breaking Change] Standardize pattern matching logic between tasks.
* Clarified relative input matching rules: patterns are evaluated relative to SourceDirectory, separators are normalized to /, matching is case-insensitive, glob mode supports \* and \*\*, and \<regex> enables regex evaluation against the relative path and file name.

### \[2.0.0] - 2025-10-14

#### Fixed

* Fixed issue with impersonation when moving files between remote places.
* Fixed issue with PreserveDirectoryStructure when regex patterns were used.

#### Changed

* Added options to handle errors
* Add Success and Error parameters to Result object
* Upgrade target framework to net8.0

  **Breaking Changes**

  * Moved parameters related to impersonation to new Connection tab
  * Renamed input Directory to SourceDirectory

### \[1.4.0] - 2025-08-12

#### Changed

* Refactor ExecuteAction to run synchronously for impersonated calls.

### \[1.3.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.2.0] - 2025-03-13

#### Fixed

* Fixed bug where regex patterns were not handled correctly in file matching.

### \[1.1.0] - 2024-11-1

#### Fixed

* Fixed issue with Task not working with impersonation by removing the source file in the main method.

### \[1.0.0] - 2023-02-14

#### Added

* Initial implementation


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.frends.com/tasks/tasks/files/move.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
