Assuming that the file names are in a file, one on each line, with no extension, this code might do it. When you are confident that the correct files will be moved, remove the -WhatIf
from the Move-Item
cmdlet.
$names = Get-Content -Path '.\filelist.txt'
Get-ChildItem -File -Path 'C:\the\directory' |
ForEach-Item {
if ($names -contains $_.Name) {
Move-Item -Path $_.FullName -Destination 'C:\the\other\directory' -WhatIf
}
}
solved Moving files from one location to another with a wildcard file extension?