Solved

VB.NET | Purge files

Posted on 2006-06-26
2
420 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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 …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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