We help IT Professionals succeed at work.

Copy Large Number of Files Using PowerShell

Ray Turner
Ray Turner asked
on
72 Views
Last Modified: 2019-01-11
How do you use PowerShell to copy all files in a directory (with all sub-folders) on the drive to another drive?

For example

xcopy c:\test\*.* d:\test /s
Comment
Watch Question

Active Directory/Exchange Engineer
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
RobertSystem Admin
CERTIFIED EXPERT

Commented:
I agree with Fox Robocopy is the way to go.
However if you need to do it with powershell for some reason the Copy-Item command using the -Recurse option would copy all sub folders.
Jose Gabriel Ortega CastroTop-Rated Plus Freelancer (Upwork)/EE Solution Guide / CEO / Photographer
CERTIFIED EXPERT
Awarded 2018
Distinguished Expert 2018

Commented:
I've been trying to substitute robocopy and xcopy with my PowerShell script :)

https://gallery.technet.microsoft.com/scriptcenter/Copy-Files-from-folderA-to-29710ef9

So I'd go and use my script.
Ray TurnerSenior Consultant

Author

Commented:
Thanks!  This is great!