How to copy all files by specified extension to another location recursively

Solution 1:

That's because the object name returned by the cmdlet doesn't include the extension, you need to append \*. I'm not sure if Copy-Item allows you to "collapse" the destination directory, so I would use Get-ChildItem with -Recurse and pipe it to Copy-Item

Get-ChildItem -Path "C:\Users\genadi\Pictures\*" -Include *.jpg,*.png -Recurse | Copy-Item -Destination D:\