Friday, October 14, 2022

Powershell to copy files from one file server share to another file server share

Instead of using Windows File Explorer to copy large files/folders from one \\fileserver\share to another, it is problematic when you continually get prompted to overwrite files or other errors cause the process to stop until user responds to the prompt.  I found that using powershell works better.

Copy-Item -Path "\\Fileserver01\share$\john.doe" -Destination "\\Fileserver02\share$\" -Recurse -Force -WhatIf

# Remove -WhatIf flag to actually do it.
# -Recurse copies files and subfolders.
# -Force copies/overwrites files even if destination is readonly.

Hope you find that useful.

No comments:

Post a Comment