I have a long directory path. The nested folder values keep changing as per project name. but last directory PackageTmp does not change, Looking forward to copy files from PackageTmp to another directory. I want to copy all subfolder and files from C:\unzip\Content\D_C\a\1\s\src\prj\obj\Release\Package\PackageTmp to C:\deploy. My code is copying to C:\deploy\PackageTmp.
Source Dir :- C:\unzip\Content\D_C\a\1\s\src\prj\obj\Release\Package\PackageTmp
Inconsistent Path :- \D_C\a\1\s\src\prj\obj\Release\Package\
Target Dir :- C:\deploy\
Non working code :- Get-ChildItem C:\unzip\ -Filter PackageTmp -Recurse | where {($_.psiscontainer)}| Copy-Item -Destination C:\deploy\ -Recurse -filter * -Force