How can I copy the folder names to the filenames during the copy. At the moment the script copies only files from the subdirectory without all folder and sub-foldername. However, I want which takes the absolute pathname while copying.
Here an example: Folder1 Subfolder1 Subfolder2 Subfolder3 Subfolder4 File1 Folder2
Then a copied file would be called so:
Folder1_Subfolder1_Subfolder2_Subfolder3_Subfolder4_File.pdf
Powershell code:
Get-ChildItem –path C:\12 -Recurse -Include "*.???" |
Foreach-Object { copy-item -Path $_.fullname -Destination c:\12 }