Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Copy Folders Only if Folder Exists in Destination

$
0
0

So i have server A and I want to call a list of folders to use to copy over to server B without creating new folders on B.

If Server A has: Folder2, Folder2, Folder3 and

Server B Has Folder1, Folder2, I only want to copy 1&2.

This is what I have so far, but it copies and creates new folders on the destination.

$users = Get-ChildItem "\serverac$users" foreach ($user in $users){ $folder = "U:users" + $user Copy-Item "M:sourcefolder*" $folderDesktop -recurse } 

submitted by /u/wogadmin
[link] [comments]

The post Copy Folders Only if Folder Exists in Destination appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles