Folder Deletion VB.net menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Roger Fang's Avatar Banned
    Reputation
    17
    Join Date
    Aug 2008
    Posts
    113
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Folder Deletion VB.net

    I am making a realmlist changer in vb.net and cannot seem to be able to delete the cache file through code. Does anyone have any code suggestions as to how I may do this. I have searched the internet and have found nothing as of yet.

    Help is greatly appreciated and will always be rewarded with reputation points

    Folder Deletion VB.net
  2. #2
    Zurkei's Avatar Contributor

    Reputation
    91
    Join Date
    Apr 2007
    Posts
    405
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Roger Fang View Post
    I am making a realmlist changer in vb.net and cannot seem to be able to delete the cache file through code. Does anyone have any code suggestions as to how I may do this. I have searched the internet and have found nothing as of yet.

    Help is greatly appreciated and will always be rewarded with reputation points
    Here this code should work for VB.NET if it doesn't just tell me and I will figure out what is wrong. Also I cannot remember if the Form1 part is required just try both ways.

    Code:
    Imports System.IO
    Public Class Form1 Inherits System.Windows.Forms.Form
     
     'Windows Form Designer Generated Code
     
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
    As System.EventArgs) Handles MyBase.Load
     
    End Sub
     
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As_
    System.EventArgs) Handles Button1.Click
     
    Try
    Directory.DeleteDirectory(TextBox1.Text)
     'Delete a directory by specifying a path in the TextBox, of the form c:\examples
    'Instead of using a TextBox you can directly type the location of the directory like this
    'Directory.DeleteDirectory("c:\examples")
    Catch
    End Try
    MsgBox("Done")
    End Sub
    Hope I helped. ^^
    Last edited by Zurkei; 11-17-2008 at 09:15 PM.

  3. #3
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Public Shared Sub DeleteCache(ByVal dir As String)
        Dim dirs As String() = Directory.GetDirectories(dir)
        If dirs.Length <> 0 Then
            For Each s As String In dirs
                DeleteCache(s)
            Next
        End If
        Dim files As String() = Directory.GetFiles(dir)
        For Each s As String In files
            ' Make sure the file isn't R/O
            File.SetAttributes(s, FileAttributes.Normal)
            File.Delete(s)
        Next
    End Sub
    Pass it the 'Cache' folder. (Normally C:\Program Files\World of Warcraft\Cache)

    It'll do a recursive deletion (to avoid silly problems with access rights and such).

  4. #4
    Gamer's Avatar Active Member
    Reputation
    239
    Join Date
    Jan 2007
    Posts
    198
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternatively just

    Code:
    my.Computer.FileSystem.DeleteDirectory(directory as String)
    eg:
    Code:
    my.Computer.FileSystem.DeleteDirectory("C:\Program Files\World of Warcraft\Cache")

  5. #5
    Zurkei's Avatar Contributor

    Reputation
    91
    Join Date
    Apr 2007
    Posts
    405
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Gamer View Post
    Alternatively just

    Code:
    my.Computer.FileSystem.DeleteDirectory(directory as String)
    eg:
    Code:
    my.Computer.FileSystem.DeleteDirectory("C:\Program Files\World of Warcraft\Cache")
    That might be easier but he would learn more form the other codes.

  6. #6
    Pragma's Avatar Contributor
    Reputation
    261
    Join Date
    Feb 2007
    Posts
    630
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use
    Code:
    Directory.Delete("Cache\WDB", True)
    The true is for deleting subdirs


  7. #7
    Hellgawd's Avatar Member
    Reputation
    710
    Join Date
    Jun 2007
    Posts
    2,480
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This thread halped meh create epicness, thanks <3

Similar Threads

  1. Replies: 1
    Last Post: 12-16-2008, 09:43 PM
  2. Replies: 10
    Last Post: 06-28-2008, 10:43 PM
  3. Delete WoW Cache Folder (EASY)
    By xiamsocrunkx in forum World of Warcraft Guides
    Replies: 6
    Last Post: 05-10-2008, 04:33 PM
  4. [help] MES deleted my data folder
    By craftermain in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 04-04-2008, 02:28 AM
  5. Auto Delete WDB folders for Microsoft and Macintosh
    By Domminust in forum World of Warcraft Bots and Programs
    Replies: 10
    Last Post: 04-20-2007, 12:29 PM
All times are GMT -5. The time now is 01:16 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search