Solved

VB.NET | Purge files

Posted on 2006-06-26
2
417 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 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