A few suggestions.
- You need to pipe the results to Foreach-object so that you can move each file.
- You can use -whatif to test the move operation.
- I like to test by writing output to double check what I am doing
- The common way of check if an object is a file or dir is to use .PSIsContainer
When using pipe you can go to the next line for readability.
get-ChildItem $path -recurse -ErrorAction "SilentlyContinue" -include $Extension | Where-Object { !($_.PSIsContainer) -and $_.Length -gt $size } | ForEach-Object { Write-Output "$($_.fullname) $($_.Length / 1Mb)" Move-Item $_.fullname C:\misc -whatif }