◐ Shell
clean mode source ↗

Preserve source directories for wildcard Move-Item destinations by KirtiRamchandani · Pull Request #27601 · PowerShell/PowerShell

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a regression fix/behavior change for Move-Item when moving multiple items (e.g., via wildcard) so the destination container is created up-front in a way that preserves source directory structure, and adds a test to validate it.

Changes:

  • Add a new pre-step in Move-Item to create the destination directory once for multi-item moves when appropriate.
  • Add a Pester test covering wildcard moves and verifying subdirectories are preserved under the destination.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 Adds a regression test for Move-Item wildcard behavior and destination container creation.
src/Microsoft.PowerShell.Commands.Management/commands/management/Navigation.cs Implements destination container creation logic for multi-item Move-Item scenarios.