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


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

Updated on: 12-Mar-2020

6K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements