I am trying to copy all .pdf files from all folders and sub folder (dirs. and subdirs).
Folder1
1.pdf
2.pdf
Folder1\Foder2\3.pdf
Folder1\Folder2\4.pdf
Folder1\Foder2\Folder3\5.pdf
Folder1\Folder2\Folder3\6.pdf
First I used
$source = "c:\Folder1\"
$desti = "D:\foderA\"
PS> Get-ChildItem -recurse $source -Filter "*.pdf"
It displays all the files in dir and sub dir but when I try to use copy-Item I get the error.
PS> Get-ChildItem -recurse $source -Filter "*.pdf" | % {Copy-Item $_ -destination $desti}
Error: Copy-Item : Cannot find path 'C:\Folder1\Folder2.... because it does not exist. Error points to source being non-existent. What am I doing wrong? Is it because I have read only on the source drive\Folder?
Thanks