delete files in a folder but not subfolders

by willbs at 2013-04-10 12:53:50

i have this command for example

remove-item -path C:\serverfolders\users*

i want to delete all of files in the “users” folder but i don’t want to delete any subfolders whose names are unknown to me, any ideas?
is there an -exclude folders type command?
by ArtB0514 at 2013-04-10 12:59:21
Version 2:
Get-Childitem C:\serverfolders\users* | Where-Object {-Not $.PSIsContainer} | Foreach-Object {Remove-Item $.FullName}

Version 3:
Get-Childitem C:\serverfolders\users* -File | Foreach-Object {Remove-Item $_.FullName}
by willbs at 2013-04-10 13:40:25
that’s a bingo, thanks Art
by ArtB0514 at 2013-04-10 13:44:43
You’re very welcome.