# Change -Path C:\Test\ to the location the files need to be moved from with the trailing \
$Files = Get-ChildItem -Path C:\Test\ -Filter "*.txt" -Recurse
foreach($File in $Files)
{
if ($File.Name -like "dogs*.txt")
{
Move-Item -Path $File.FullName -Destination "Y:\Dogs\"
}
elseif ($File.Name -like "cats*.txt")
{
Move-Item -Path $File.FullName -Destination "Y:\Cats\"
}
}