My file structure is like this:
ParentFolder
ChildFolder_1
- xyz.mat
- abc.mat
- image_xy.mat
ChildFolder_2
- xyz.mat
- abc.mat
- image_xy.mat
ChildFolder_N
- xyz.mat
- abc.mat
- image_xy.mat
I want to copy only image_xy.mat
from each folder and paste it to another location in same hierarchy.
So far with the following reference: How to use powershell copy-item and keep structure
I tried doing this:
$source = "H:\data"
$dest = "C:\Mydata"
Get-ChildItem -Path $source | Copy-Item -Destination $dest -Recurse -Container
This just copies every file without filtering. I just need image_xy.mat
How can I accomplish this in powershell?