Powershell copy-item creates a folder instead of copying file

Viewed 931

I mapped a webdav folder with new-psdrive, cd to a folder, then try to copy one file to a local folder. The script code (draft) is the following:

New-PSDrive -Name WEBDAV -PSProvider FileSystem -Root "\\testserver@SSL\davwwwroot\myApp"
cd WEBDAV:
cd "notes\user"
Copy-Item -Path ".\important.txt" -Destination "c:\temp"

What I see, that after the Copy-Item a new empty FOLDER "C:\temp\important.txt" is created. Not a file. When I change the "copy-item" command to "robocopy" it works perfectly. I am wondering what is wrong with the copy-item... How could I use it to do the work?!

1 Answers

simply specify the file name:

Copy-Item -Path ".\important.txt" -Destination "c:\temp.txt"
Related