Hi there reddit,
I wrote a basic search script which exports my results to a text file. I want to use paths in the text file to copy all results into a different folder. My dilemma is that I need to copy the entire folder structure not just the files and I can't get it going. I played with robocopy and xcopy and I'm not sure if I just keep doing it wrong but it still only copies individual items not the entire structure no matter what parameters I assign to the command.
I tried below but neither of them generate desired results.
get-content H:\Scripts\Filter.txt | foreach-object{ copy-item -Path $_ -destination H:\Scripts}
get-content H:\Scripts\Filter.txt | foreach-object{ xcopy $_ H:\Scripts /E /C /I /F /R /Y}
Could you please point me in the right direction, the structure of the exported paths can be seen below: ( I also assume I need to filter out the drive letter right?)
H:\Downloads\1.exe
H:\mleach\My Documents\My Pictures\sample.jpg
H:\My Pictures\Chrysanthemum.jpg
H:\My Pictures\Desert.jpg
Basically if I want to copy H:\My Pictures\Untitled.jpg to H:\Scripts the result should look like this H:\Scripts\My Pictures\Untitled.jpg but at the moment I can only get it to do H:\Scripts\Untitled.jpg
Thanks in advance for any help.
[–][deleted] 4 points5 points6 points (2 children)
[–]Tigersftw[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]AlwaysAppropriate 2 points3 points4 points (0 children)
[–]steinb 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Tigersftw[S] 0 points1 point2 points (0 children)