Source Code and Samples

Friday 2 February 2007

How to delete all .txt files in a directory and all sub-directories

Description


The one-liners below can be used to recursively delete all .txt files in a given directory and all its sub-directories.

Source Code

Get-ChildItem -include "*.txt" -recur remove-item
or
Get-ChildItem -rec -filter *.txt remove-item

No comments: