Hi<\/p>\n
i’m stuck with my PS script. I looked everywhere but i can’t find what i’m looking for. I have a masterfolder that contains 1000 files.<\/p>\n
Each file has the same filename in the destination folder that contain many subfolders. I need to move the files out of the masterfolder to the destination folder based on filename and replace them.<\/p>\n
Is there an easyway to do this. I’m especially struggling with the part where i have to find in the destinationfolder the exact match of filename before i can move and replace it.<\/p>\n
Something like:<\/p>\n
$source = “path”
\n$destination = “path”<\/p>\n
get-childitem $source | foreach-object {Move-item $_.name -match $destination -recurse }<\/p>\n
Can someone help me what i’m doing wrong and how i can fix it?<\/p>\n
Thank you<\/p>","upvoteCount":4,"answerCount":2,"datePublished":"2020-04-11T19:10:48.000Z","author":{"@type":"Person","name":"spiceuser-zj4ni","url":"https://community.spiceworks.com/u/spiceuser-zj4ni"},"suggestedAnswer":[{"@type":"Answer","text":"
Hi<\/p>\n
i’m stuck with my PS script. I looked everywhere but i can’t find what i’m looking for. I have a masterfolder that contains 1000 files.<\/p>\n
Each file has the same filename in the destination folder that contain many subfolders. I need to move the files out of the masterfolder to the destination folder based on filename and replace them.<\/p>\n
Is there an easyway to do this. I’m especially struggling with the part where i have to find in the destinationfolder the exact match of filename before i can move and replace it.<\/p>\n
Something like:<\/p>\n
$source = “path”
\n$destination = “path”<\/p>\n
get-childitem $source | foreach-object {Move-item $_.name -match $destination -recurse }<\/p>\n
Can someone help me what i’m doing wrong and how i can fix it?<\/p>\n
Thank you<\/p>","upvoteCount":4,"datePublished":"2020-04-11T19:10:48.000Z","url":"https://community.spiceworks.com/t/move-multiple-items-to-subfolders-same-filename/758745/1","author":{"@type":"Person","name":"spiceuser-zj4ni","url":"https://community.spiceworks.com/u/spiceuser-zj4ni"}},{"@type":"Answer","text":"
maybe a hash lookup table would be more efficient?<\/p>","upvoteCount":0,"datePublished":"2020-04-11T19:17:30.000Z","url":"https://community.spiceworks.com/t/move-multiple-items-to-subfolders-same-filename/758745/2","author":{"@type":"Person","name":"Neally","url":"https://community.spiceworks.com/u/Neally"}}]}}