Hello PSADT friends,
I have a requirement within an SCCM Application (Deployment) to copy Files (and Folders/Sub Folders) to various locations on the endpoint. Sounds cryptic, let me try explain:
Destination folders include
I am familiar with the Copy-File or Copy-Item functions, but it looks like I can only specify this once ($dirSourceFiles for example)
Is there a way I can perform repeat file copies?
I’m assuming your question is how to copy the content from a folder included under ‘.\Files’ recursively?
According to your list, here’s how it should look like:
Copy-File -Path “$dirFiles\folder1\*” -Destination “$envProgramFilesX86\Microsoft Office\Templates” -Recurse
Copy-File -Path “$dirFiles\folder1\*” -Destination “$envProgramData\FolderName\Destination” -Recurse
Copy-File -Path “$dirFiles\folder1\*” -Destination “$envProgramFilesX86\FolderName\Destination” -Recurse
Nice one, that inadvertently helped me out - was having issues with -recurse although i had been trying just \ or *.*
soon as i changed to just * like your example it worked perfectly!