List and delete files using Windows PowerShell

| |

To list files of specific type(s) on the disk or directory including all sub-directories

get-childitem c:\ -include *.tmp, *.temp, *.bak -recurse 

get-childitem D:\Projects\abc*\ -include *.bak -recurse 

The commands above will list on screen all files with extentions TMP, TEMP or BAK located on disk C:\ and all subdirectories or located on disk D:\ in directory PROJECTS and all subdirectories with name starting with ABC and their subdirectories.

To delete files of specific type(s) from the disk or directoty including all sub-directories add

| foreach ($_) {remove-item $_.fullname}

2016/04/18 17:17