Saturday, February 03, 2007

Delete All Files Using Powershell

Where have I been for the last two months? Looking after my first son, Andre Ashton, born on 30th December 2006. I have however, been doing a phenomenal amount of work on Movie Maker in Vista, it's too much fun! I also purchased a Seagate Barracuda 320Gb SATAII hard disk and a Vantec NexStar3 case with an eSata port. I attach the disk to my laptop with an eSata PCMCIA adapter and it really flies, three times as fast as USB.

Anyway, here's a PowerShell tip. To delete all files in a directory except those with a specific extension
, use the Remove-Item Cmdlet.

Remove-Item e:\video\* -recurse -force -exclude *.mpg