Recursively delete files in Windows

Contributor Icon Contributed by qmchenry Date Icon October 11, 2003  
Tag Icon Tagged: Windows

The del command allows recursive removal of specified files.


To delete all files ending in .tmp in the current directory and all subdirectories, use:

del /s *.tmp

Warning: Be certain you know exactly what you are doing before using the command. To be more careful, you can specify that the del command will prompt for confirmation before deleting each file:

del /s /p *.tmp

Previous recipe | Next recipe |
 
  • Anonymous
    Living dangerously - Or 'How to make it STFU'

    del /s/q tmp*

    Unix:
    rm -fr tmp/*

    Results may vary :twisted:
  • Anonymous
    That worked so much better. Stupid hidden files.. :twisted:
  • Rajesh
    May I know how to the "folders" instead of files recursively?
    (Assume the folders aren't empty.)
  • Rajesh
    ** May I know how to DELETE the "folders" instead of files recursively?
    (Assume the folders aren't empty.)
  • dhanu
    thank you very much
blog comments powered by Disqus