How can I delete all text files (only) from a parent folder and all its child folders (without deleting any of the folders)? I am using Windows 8 but the answer shouldn't be too different for other windows versions.
4 Answers
Executing del /s /q /f *.txt. You'll need write permissions on each of the directories and files to do so. The /s goes down each folder, /q to keep quiet (don't ask for confirmation), and the /f enables deleting of Read Only files
From a command prompt in the parent directory: del *.txt /s
Or, you can search the folder using windows search for *.txt giving you a list of all text files found; then you could select all in the list and delete them.
I'm all for the command line, but this is a graphical solution.
Heck, here's yet another solution if you want to user powershell:
get-childitem C:\ -recurse | | ?{$_.Fullname -match '.*\.txt'} | %{remove-item $_.fullname -force}