Hi,
I have a folder which contain both sub folders and files. I want to copy all the contents (Files,subfolders and its contents) excluding a specific subfolder and its contents. I tried the below one but it didn’t work.
$inputFolder = ‘D:\dinesh\run’
$excludefolder= ‘dataset’
$target = ‘E:\kumar\run’
Get-ChildItem -path $inputFolder -Recurse | Where {$.FullName -notlike $excludefolder} | Copy-Item -Destination {Join-Path $target $.FullName.Substring($inputFolder.length)}
The above command is copying the $excludefolder contents as well but it should not.
Can any one suggest a way to get it done.
Thanks.