How do you delete all the txt files from one folder and all sub folders?
remove-item -Path Logs -Filter *.txt -Recurse
This works but it tries also to delete the subfolders and raises some exceptions
remove-item -Path Logs\* -Filter *.txt -Recurse
This doesn't delete the txt files in the subfolders
remove-item -Path Logs -Include *.txt -Recurse
This does exactly nothing, most probably because the Path has no wildcard
remove-item -Path Logs\* -Include *.txt -RecurseThis doesn't delete the txt files in the subfolders
It seems a simple task, but it doesn't, so I tried all the combinations of path with include and filter but no one really works, what I missing?