I have an issue with moving folders.
simple string like "move-item -path c:\test -destination c:\tmp -force" gives output
Move-Item : Cannot create a file when that file already exists.At line:1 char:10+ move-item <<<< -path c:\test -destination C:\tmp -force + CategoryInfo : WriteError: (C:\test:DirectoryInfo) [Move-Item], IOException + FullyQualifiedErrorId : MoveDirectoryItemIOError,Microsoft.PowerShell.Commands.MoveItemCommand
(folder c:\tmp\test already exist)
I am local administrator, folders could be replaced via cmd or explorer easy.
Where could be an error?
Apparently, -force will only allow you to overwrite existing files but not folders
After thinking about it, replacing an existing folder has a lot more consequences than replacing an existing file. This may be why the provider handles both differently.
I do agree though unless I am overlooking something, using -force should replace folders as well.
As a workaround, you could use copy-item:
Copy-Item c:\test -Destination c:\tmp -Force -Recurse
It works because it would not replace existing folders but just appends them with new stuff. After calling copy-item, you would have to delete the original folder in a second step.
The idea was to avoid copying process because of the time (I need to move large amounts of data (30-40 GB))
Powered by IDERA