Delete just files

Hi guys!

Just a quick script, to remove just the files on a specified directory, not the subfolders or the files in the subfolders

Start-Transcript C:\remove_transcript.txt
$folderlist  = Get-ChildItem C:\yourfolder
$folderlist | % {
        Get-ChildItem  ( "C:\yourfolder\" + $_ ) | where { ! $_.PSIsContainer } | Remove-Item -Confirm:$false -Verbose
}
Stop-Transcript

Enjoy!

AR

Leave a comment