Sunday, August 30, 2009

How can I use PowerShell to delete all the files with a particular extension

Just run the command:

get-childitem rootdir -include *.extension -recurse | foreach ($_) {remove-item $_.fullname}


And that is it. Thanks Scripting Guy.



This is specially useful for me because very often, after I make changes in project reference in VS.NET some .dll files are left “out of sync” and and make parts your project act as if you did not re-compiled them. Sadly there is no easy way to tell VS.NET to get rid of all the .dll files that may be causing problems.

No comments: