Solved

VB.NET | Purge files

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now