Recursively Delete Selected Files or Folders In Windows

R

I was looking around for a way to recursively delete files and folders of a specific name in Windows. For example, imagine having “/folderA/folderB/file1.doc” and “/folderA/folderC/file1.doc”, and I wanted to remove all instances of file1.doc. Now imagine this file1.doc being presented in hundreds of folders. Deleting each file manually would drive anyone crazy.

I know Unix has a more powerful commandline interface, so operations like this should be a snap, but I was certain Windows had a similar functionality too. So I went about searching for a simple solution to do so. I was so intent on finding a simple batch file or DOS command that would do the recursive delete that I didn’t think of anything else until it suddenly slammed into me like a bullet train.

I could just use the search function in Windows! Yes that’s right — the normal Windows search is already a powerful enough function that accepts wildcards and does recursive searching. So I went to Windows search, specified my folder, and put in my filename. Sure enough, all the hundred or more instances of that file popped up almost instantly. From there it was just a matter of selecting all of them and deleting them. Everything took less than 10 seconds!

Similar Posts:

About the author

Alvin Poh

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.

3 comments

By Alvin Poh

About Author

I've over 17 years of entrepreneurship experience, having built a tech company to be the top in the country, which was subsequently acquired for an 8-figure sum. As CEO, I led the company through robust growth to 150 employees across 4 countries. After the acquisition, I embraced minimalism, sold off my personal possessions, and started living around the world.

Read more about my story here.