The default behavior is to NOT prompt.
Remove the -Confirm
And your logic looks backwards
Get-ChildItem | Where { $_.Length -Le 1000000} | remove-item -force -whatif
REMOVE the whatif if this does what you expect.
Brandon Shell
---------------
Blog:
http://www.bsonposh.com/
PSH Scripts Project:
www.codeplex.com/psobject
F> Hello,
F>
F> I am wanting to remove some files from a directory based on some
F> criteria and the script works, however, I don't want the confirmation
F> to prompt, I just want the files to delete, however, when I include
F> the -confirmation parameter, PowerShell throws an error saying it
F> can't match it. Here is what I currently have that is not working:
F>
F> Remove-Item -path .\. -confirm A | Get-ChildItem | Where { $_.Length
F> -Le 1000000 }
F>
F> "A" is suppose to be the "Yes to All" and that is what I want to
F> pass. What is the correct syntax for this?
F>
F> Thanks,
F> Flea#