Recursively Delete Files and Retain Folders in Windows

Thu, Jan 3, 2008

Miscellaneous


I was trying to delete all files in the current directory and all subdirectories, while keeping the directory structure intact. I found that I could use the following DOS command to recursively delete files, and NOT touch the directories:

ending in .doc

del /s *.doc

Do note though, that ALL files with the extension doc will be deleted. You can change .doc to something else, .mp3 .pdf .wav .am .rm .txt, it’s all up to you. If you require confirmation before deleting, you can have the del command prompt for confirmation before deleting each file by modifying the command slightly:

del /s /p *.doc

Similar Posts:

Tags: , , , , , ,
, , , , , ,

This post was written by:

- Alvin is a Singaporean who's interested in marketing, techy stuff and likes to just figure out how the two can work with each other. On top of his blog, you can also follow him on Twitter.

Get Alvin's Report On How To Blog Successfully - Free!

1 Comments For This Post

  1. Napoleon Says:

    Yea, worked well!

Leave a Reply

*