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
Solved

VB.NET | Purge files

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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