Sorry for the basic question but I’m stumped. Everything else is working but I can’t get the script to copy a folder.
Originally I had it doing something more complicated but for now I’m just trying the very basic.
Copy-File -Path “$dirSupportFiles*.*” -Destination “C:\Apps” -recurse
in my SupportFiles directory I have a folder called “Avaya” and a document called “batman.txt”. Only “batman.txt” gets copied over.
So I ended up abandoning Copy-File and instead just used Copy-Item.
<code>
$User = $($CurrentLoggedOnUserSession.Username)
Copy-Item "$dirSupportFiles\*" "C:\Users\$User\Appdata\Roaming" -Recurse
</code>
darren
September 8, 2017, 6:39pm
3
Was doing some searching and found this post. I have the same problems. At the same time the copy to $evnCommonPrograms was dumping to the root of C for some reason as well.
jim
September 12, 2017, 4:38am
4
Here’s what I did. The folder name is ‘Home Care Access’ and gets copied to the Public Desktop:
Copy-File -Path “$dirFiles\Desktop Folders\Home Care Access” -Destination $envCommonDesktop -Recurse
1 Like
I had the same problem.
The trick is to use just * instead of *.*
So,
Copy-File -Path “$dirSupportFiles*” -Destination “C:\Apps” -recurse
will copy the folders also.
(Keep in mind that powershell is working with objects, not with strings like DOS.)