Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Jul 12

Written by: Steve Gray
7/12/2010 9:23 AM  RssIcon

I need to search a directory and find all occurrences of a certain directory name and delete that folder and all contents. I’m using an application for handling photos and it created a directory called ‘50x40’ in a photo gallery directory to hold thumbnails. This directory is in each folder in the drive, and I count 176 of them. I’m too lazy to manually delete all those folders… and I have a long history spending 4 hours writing code to handle a task that I could have done in one.

At least I’m aware of my issues, right?

Code to search for a certain directory and delete it. You might need to IMPORT or set a reference to SYSTEM.IO

For Each s As String In Directory.GetDirectories("\\devshed04\photos\", "50x40", SearchOption.AllDirectories)
    Directory.Delete(s, True)
Next s

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us