Looking for some help with Powershell (which I'm totally new to). I'm trying to copy a number of files from one location to another using Copy-Item but can't get it to copy to the correct nested folders.
Roughly...
Each item of $Files is a filename and it's path relative to root, e.g.
directory1/file1.txt
directory1/file2.txt
directory2/file1.txt
etc.
Not sure if my loop method is the best but, it works...
The files are copying but being placed in the root of the destination folder rather than in appropriate sub folders (whether they exist or not)
Many thanks.
Roughly...
Code:
...
$files = git diff --name-only --diff-filter=ACMRTUXB 1843ac2 79f7aaa
$source = "D:\source"
$destination = "D:\destination"
for ($i=0; $i -lt $files.Length; $i++) {
$files[$i] # just to show me the files
Copy-Item $files[$i] $Destination
}
...
Each item of $Files is a filename and it's path relative to root, e.g.
directory1/file1.txt
directory1/file2.txt
directory2/file1.txt
etc.
Not sure if my loop method is the best but, it works...
The files are copying but being placed in the root of the destination folder rather than in appropriate sub folders (whether they exist or not)
Many thanks.