Skip to content

Latest commit

 

History

History

Inconsistent-destination

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Copy-Item inconsistent destination directory

If a directory 1 is copied by Copy-Item then the result depends on existence of the destination directory 2.

  • If 2 does not exist then Copy-Item works as expected, the destination 2 is created and files from 1 are copied to 2.
  • If 2 exists, for example the same command is called again, then Copy-Item works as if the destination is 2/n1 where n1 is the name of directory 1.

Workaround

The following workaround is suggested at Connect:

    mkdir $destination -Force
    Copy-Item $source\* $destination -Recurse -Force

Scripts


  • Microsoft Connect 809855