|
RE: file copy operations using source file input and script? @'
E:\path\1\file1.ext
E:\path\1\file2.ext
E:\path\1\file3.ext
E:\path\1\file4.ext
E:\path\1\file5.ext
E:\path\2\file.ext
E:\path\2\file2.ext
E:\path\2\file3.ext
E:\path\2\file4.ext
E:\1\path\1\file1.ext
E:\1\path\1\file2.ext
E:\1\path\1\file3.ext
'@ > listing.txt
# before
tree E:\path /f /a
tree c:\path /f /a
tree E:\1 /f /a
tree c:\1 /f /a
# this assumes that the paths in listing.txt are valid and point to an
# existin file
$root = 'E:\\'
$destRoot = 'C:\\'
gc listing.txt | % {
$dest = $_ -replace $root, $destRoot
$parent = split-path $dest
if (!(test-path $parent)) {ni $parent -i d* -vb}
cpi $_ $dest -vb
}
# after
tree E:\path /f /a
tree c:\path /f /a
tree E:\1 /f /a
tree c:\1 /f /a
--
Kiron |