How to copy multiple files in PowerShell using Copy-Item?

PowerShellMicrosoft TechnologiesSoftware & Coding

To copy the multiple files in PowerShell, you need to separate each file with the comma (,).

In the below example, we will copy multiple files from the source to the destination folder D:\TempContent.

Example

Copy-Item .\PowerShellcommands.csv,.\cars.xml -Destination D:\TempContent\ -PassThru

Output

PS D:\Temp> Copy-Item .\PowerShellcommands.csv,.\cars.xml -Destination D:\TempContent\ -PassThru
    Directory: D:\TempContent
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       20-01-2020     12:10        1148809 PowerShellcommands.csv
-a----       07-05-2018     23:00            301 cars.xml
raja
Published on 12-Mar-2020 11:28:46
Advertisements