Skip to content

Move-Item recursively creates "infinitely" nested directories #16089

@PAStheLoD

Description

@PAStheLoD

Prerequisites

Steps to reproduce

mkdir test
cd test

mkdir abc
mv * abc

Don't forget to hit ctrl-c fast.

dir -Recurse t shows the created structure. I used 7zip File Manager to shift-del the nested dir structure.

Expected behavior

PS should not create the nested directory structure, it should ignore the target when expanding the wildcard into the source list, move everything else into the target directory.

In this example it should basically do a no-op, since there's nothing else to move into "abc".

Actual behavior

A directory that contains a directory, that contains a directory ... t\abc\abc\abc\abc ...

Environment data

PSVersion                      7.2.0-preview.9
PSEdition                      Core
GitCommitId                    7.2.0-preview.9
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions