Hello,
I am a new to Powershell and I have been given a task to copy all folders/subfolders files from source to destination using csv file in powershell.
I have managed to pull files from source to one destination but what if I need to copy the same file structure (including folder/subfolder) from source to destination (creation of same folder/subfolder) where no folder structure is created prior using csv and powershell?
This is the script below I used to copy files from source to destination but how about creating a similar folders and subfolders in destination with this.
CSV:
path
C:\folder1
C:\folder3
C:\folder5
Script:
Import-Csv C:\Scripts\source.csv | ForEach-Object{Get-ChildItem -Path $_.path |
Sort-Object -Property CreationTime -Descending |
Copy-Item -Destination 'C:\testfolder' -recurse -Force -Verbose}
Thanks in advance
Akshay

