dotnet / dotnet/msbuild

[Feature Request]: Tasks - Support moving directories in the Move Task

Open
#8,795 1 comment 7 reactions 0 assignees View on GitHub
backlog Feature Request gathering-feedback triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Summary

MSBuild doesn't directly provide for moving a directory.

### Background and Motivation

Build scripts sometimes need to collect or assemble files into a specific directory structure. If multiple copies of the files are not needed (or need to be avoided) moving a directory within the same file system is faster and uses less disk space than copying and removing the original.

### Proposed Feature

The source code for the [`Move`](https://learn.microsoft.com/en-us/visualstudio/msbuild/move-task?view=vs-2022) task mentions that [moving a directory could be supported](https://github.com/dotnet/msbuild/blob/7d65cb31cdbb92774e28adc44e73f03fdb103e62/src/Tasks/Move.cs#LL20C1-L24C19). The `Move` task could be extended to support moving directories.

Extending `Move` to support directories might follow a pattern similar to proposed changes to the [`Copy`](https://learn.microsoft.com/en-us/visualstudio/msbuild/copy-task?view=vs-2022) task (see ##5881).

### Alternative Designs

An alternate approach could be to add a new `MoveDir` task. There are [`MakeDir`](https://learn.microsoft.com/en-us/visualstudio/msbuild/makedir-task?view=vs-2022) and [`RemoveDir`](https://learn.microsoft.com/en-us/visualstudio/msbuild/removedir-task?view=vs-2022) tasks that are specific to directories.

A `MoveDir` task may have required parameters for `SourceDirectories` and `DestinationDirectories` that are expected to be one-to-one.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.