Directory Cleaner

Results 1 to 7 of 7
  1. #1
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    happy Directory Cleaner

    Not sure if this is useful or not, but i have created it some time ago where i was at CTGunZ! so that i'll release it :P

    Its very simple, the program cleans the Directory where the Shield creates the Userlog files, like: efa, f0a, etc.

    You can select the delay of the timer (cleaning timer).

    The Program is coded in VB.NET 2008:

    Code:
    Imports System.IO
    Imports System.Threading
    Public Class Form1
        Dim Root As String = "C:\Inetpub\vhosts\toffigunz.de\httpdocs\userlogs"
        Dim filestr As String
        Dim cmdClean As String = 0
        Dim index As String = "index.php"
        Private Sub Log(ByVal data As String)
            ListBox1.Items.Add("[" & Date.Now & "] -- " & data)
            ListBox1.SetSelected(ListBox1.Items.Count - 1, True)
        End Sub
        Private Sub Del(ByVal filename As String)
            Try
                System.IO.File.Delete(filename)
                Log(filestr & " - Erased")
                Label6.Text += 1
                Label7.Text += 1
            Catch ex As Exception
                Label9.Text += 1
                Log(ex.Message)
            End Try
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Timer1.Stop()
            TextBox1.Enabled = True
            Button2.Enabled = False
            Button1.Enabled = True
            Log("Cleaner Services Stopped!")
            Label13.Text = "Offline"
            Label13.ForeColor = Color.Red
            Button4.Enabled = True
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Try
                Timer1.Interval = Val(TextBox1.Text) * 1000
            Catch ex As Exception
                Log("Your entered delay is incorrect!")
                Exit Sub
            End Try
            If Val(TextBox1.Text) < 0.5 Then Log("Delay blow 0.5 seconds can slow down!")
            Dim names As String()
            Try
                names = Directory.GetFiles(Root)
            Catch ex As Exception
                Log("Root not found or permission denied!")
                Exit Sub
            End Try
    
            Label3.Text = 0
            Label6.Text = 0
            Timer1.Start()
            Log("Cleaner Services Started!")
            Label13.Text = "Online"
            Button1.Enabled = False
            Button2.Enabled = True
            Label13.ForeColor = Color.Green
            TextBox1.Enabled = False
            Button4.Enabled = False
        End Sub
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Label11.Text = Date.Today
        End Sub
        Private Sub cleaner()
            Dim names As String()
            Try
                names = Directory.GetFiles(Root)
            Catch ex As Exception
                Log("Root not found or permission denied!")
                Label9.Text += 1
                Exit Sub
            End Try
    
    
            For Each file As String In names
                filestr = file.Replace(Root & "\", Nothing)
                If filestr = index And cmdClean = 1 Then
                    cmdClean = 0
                    Log(index & " saved - Not erased!")
                ElseIf filestr = index Then
                Else
                    Del(file)
                End If
                Thread.Sleep(20)
            Next
        End Sub
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            cleaner()
            Label3.Text += 1
        End Sub
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            cmdClean = 1
            cleaner()
        End Sub
    
        Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
            Dim xRootstring As String = InputBox("Please enter the Directory you want to set as Root:", "Root Selection", Root)
            Root = xRootstring
            Log("Root changed to: ")
            Log(Root)
        End Sub
    End Class
    To Download the Project with everything:

    Code:
    http://www.megaupload.com/?d=E357O7DL
    http://www.filefront.com/16398259/UserLog-Cleanner.rar
    http://rapidshare.com/files/385212749/UserLog_Cleanner.rar.html
    If this isn't something useful for you, don't reply :P


  2. #2
    Account Upgraded | Title Enabled! razi46 is offline
    MemberRank
    Dec 2007 Join Date
    697Posts

    Re: Directory Cleaner

    Cool!!

  3. #3
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: Directory Cleaner

    was a program really necessary? I've got batch files to do it for me

  4. #4
    Ā  Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: Directory Cleaner

    A simple batch file like this would do:

    Code:
    @echo off
    del /q .\DIRECTORY NAME\*.*
    The only extra thing in your program is the timer.

  5. #5
    Proficient Member EvilControl is offline
    MemberRank
    May 2010 Join Date
    RaGEZONELocation
    189Posts

    Re: Directory Cleaner

    Thanks , Very Help Full

  6. #6
    Sultan of Yolo Demantor is offline
    MemberRank
    May 2008 Join Date
    GermanyLocation
    1,266Posts

    note Re: Directory Cleaner

    Quote Originally Posted by dawsonbyrd View Post
    was a program really necessary? I've got batch files to do it for me
    Quote Originally Posted by phoenix_147 View Post
    A simple batch file like this would do:

    Code:
    @echo off
    del /q .\DIRECTORY NAME\*.*
    The only extra thing in your program is the timer.
    I know, i still made from it a program!
    btw. you forgot something, just 1 thing, the program isn't erasing the index file =PP
    Quote Originally Posted by Demantor View Post
    If this isn't something useful for you, don't reply :P
    Thanks for whom wrote something nice!

  7. #7
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: Directory Cleaner

    Quote Originally Posted by Demantor View Post
    I know, i still made from it a program!
    btw. you forgot something, just 1 thing, the program isn't erasing the index file =PP


    Thanks for whom wrote something nice!

    You can just make the batch file more complex and add an exception to the index file.

    and you can't expect to release something and not get critiqued so its childish to post please don't hurt my feelings.



Advertisement