OK So I've got a list of files I'm trying to copy from one folder to another.
I have a CSV with a list of partial file names eg: ABCD-EFGH
The files I want copied are in the destination folder named ABCD-EFGH-1.pdf, ABCD-EFGH-2.dxf, ABCD-EFGH-3.dwg etc
If there is a match I'm trying to copy all the files that match the partial name.
Below code doesn't throw errors, it just copies EVERYTHING from the source folder. If I remove the * from the -Path it just copies the folder itself rather than the contents of the folder. What am I missing?
$drawing_list = Import-Csv $importfile
#$drawing | Get-Member -MemberType NoteProperty
# Loop through all the records in the CSV
foreach($drawing in $drawing_list)
{
# copy all items from source folder to destination that match start of drawing name
Copy-Item -Path "$($sourceFolderName)*" -Filter "$($drawing.Name)*" -Destination $targetFolderName
}