Solved

VB.NET | Purge files

Posted on 2006-06-26
2
415 Views
Last Modified: 2012-08-13
OK - I may be asking for too much here but...

I have a directory tree similar to this:
C:\foo\user1
C:\foo\user2
C:\foo\user3

I need to purge all the files and folders WITHIN the each user folder. I have a LOT of users so hard coding the full path won't work. Any ideas?
0
Comment
Question by:potpourrigroup
2 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 16987324
Directory.Delete(PAth, True) http://msdn2.microsoft.com/en-us/library/fxeahc5f.aspx

will delete the directory and all subdirectories .. just call it for each of your paths that you want to delete.

To get the user folders just use Directory.GetDirectories http://msdn2.microsoft.com/en-us/library/c1sez4sc.aspx it also supports a search pattern i.e. user* http://msdn2.microsoft.com/en-us/library/6ff71z1w.aspx

Cheers,

Greg
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question