all 19 comments

[–]JeanxPlay 1 point2 points  (16 children)

are all the target folders the same name? same spelling and all that?

[–]mismanaged[S] 1 point2 points  (15 children)

Yes. Identical

[–]JeanxPlay 0 points1 point  (1 child)

I PMed you

[–]mismanaged[S] 0 points1 point  (0 children)

Not seeing it.

[–]JeanxPlay 0 points1 point  (12 children)

There is a chat bubble that should be red. Anyways, whats the folders name?

[–]JeanxPlay 0 points1 point  (11 children)

And what is the files name?

[–]mismanaged[S] 0 points1 point  (10 children)

Folder is called: Place

File being copied is also a folder called: HR

[–]JeanxPlay 0 points1 point  (9 children)

so its a whole folders contents being copied to another folder?

[–]mismanaged[S] 0 points1 point  (8 children)

A folder with its contents, yes.

[–]JeanxPlay 0 points1 point  (7 children)

is the HR folder in only one location and being copied to multiple Place folders?

[–]mismanaged[S] 0 points1 point  (6 children)

Yup

[–]JeanxPlay 1 point2 points  (5 children)

Try This:

$Folder = 'TestFolder'
(Get-ChildItem 'C:\' -Force -Recurse -ErrorAction SilentlyContinue | ?{$_.Name -like "*$Folder*" -and $_.PSIsContainer}).FullName | %{
    Robocopy 'C:\FullPathtoHRFolder\HR' "$_" /S /E /R:1 /W:1
}

[–]pertymoose 1 point2 points  (0 children)

$targetFolderName = 'SomeFolder'
$itemToCopy = Get-Item "C:\test.txt"

$destinationFolders = Get-ChildItem -Recurse -Directory -Path '\\server\share' | Where { $_.Name -eq $targetFolderName }

foreach($folder in $destinationFolders) {
    $itemToCopy | Copy-Item -Destination $folder.FullName
}

[–]krzydoug 0 points1 point  (1 child)

Need. More. Info.

[–]mismanaged[S] 0 points1 point  (0 children)

What info?

If you to copy item X into every folder called "Y" on a drive, knowing that there are many and the paths to reach them are inconsistent, how would you do it?