Results 1 to 10 of 10
  1. #1
    nathanael890's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    158
    Reputation
    13
    Thanks
    46
    My Mood
    Bored

    [Help] Deleting files permanently[Solved]


    I was making my application called "Bin Manager" as it can delete files in the current list.
    It was almost perfect but I had just noticed that I thought of deleting them permanently without using the recycle bin ( or even to make empty it )

    Could anyone can help me? I just need a basic one.

    Please mark my thread as solved. thank you.
    Last edited by nathanael890; 01-20-2011 at 10:35 AM.

  2. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Hmmmmmm

    What are you using , because....

    Code:
     Try
            File.Delete("C:\File.Extension")
    Catch ex As Exception
    ' Do nothing 
    ' Or display an error such as 
        msgbox (ex.tostring)
    'or msgbox("File Not Found"
    End Try

    Should delete a file without sending it to recycling bin


     


     


     



    The Most complete application MPGH will ever offer - 68%




  3. The Following User Says Thank You to NextGen1 For This Useful Post:

    nathanael890 (01-20-2011)

  4. #3
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    First results on google for "Empty the Recycle Bin VB.NET"

    Reference:
    Empty Recycle bin - VB.NET code - Visual Basic .NET answers

    Relevant code:

    Code:
    Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hWnd As Int32, ByVal pszRootPath As String, ByVal dwFlags As Int32) As Int32
    Private Declare Function SHUpdateRecycleBinIcon Lib "shell32.dll" () As Int32
    
    Private Const SHERB_NOCONFIRMATION = &H1
    Private Const SHERB_NOPROGRESSUI = &H2
    Private Const SHERB_NOSOUND = &H4
    
    #Region "Empty Recycle Bin (SUB)"
    
    Private Sub EmptyRecycleBin()
    SHEmptyRecycleBin(Me.Handle.ToInt32, vbNullString, SHERB_NOCONFIRMATION + SHERB_NOSOUND)
    SHUpdateRecycleBinIcon()
    End Sub
    
    #End Region


    Offtopic, it appears my syntax highlighter is missing the "Region" Keyword. Bugger.
    Last edited by Jason; 01-20-2011 at 10:19 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  5. The Following User Says Thank You to Jason For This Useful Post:

    nathanael890 (01-20-2011)

  6. #4
    nathanael890's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    158
    Reputation
    13
    Thanks
    46
    My Mood
    Bored
    Quote Originally Posted by NextGen1 View Post
    Hmmmmmm

    What are you using , because....

    Code:
     Try
            File.Delete("C:\File.Extension")
    Catch ex As Exception
    ' Do nothing 
    ' Or display an error such as 
        msgbox (ex.tostring)
    'or msgbox("File Not Found"
    End Try

    Should delete a file without sending it to recycling bin

    I was recently using [ Kill("<<File>>") ] to delete files.
    My friends uses some aglorithms to delete the files away but I didn't need that anyway. Thank you.

    Oh. about the message I have sent to you NextGen.. I have no received messages yet.. it was about text encrypting..

  7. #5
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    @ Jason, He doesn't want to empty, but avoid the recycling bin.

    @ Message
    Resend message, It may have been overlooked.



     


     


     



    The Most complete application MPGH will ever offer - 68%




  8. The Following User Says Thank You to NextGen1 For This Useful Post:

    nathanael890 (01-20-2011)

  9. #6
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    You can use the System.IO.File.Delete function..


    Note that none of the above suggestions (including mine) will actually delete the data. All it does is remove the index, and the data will remain there (and can be recovered) until it is overwritten by new data.

  10. #7
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Hey Rich:

    Quote Originally Posted by nathanael890 View Post

    ( or even to make empty it )

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  11. The Following User Says Thank You to Jason For This Useful Post:

    NextGen1 (01-21-2011)

  12. #8
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    @ Freedom Piece, that's what I said, I like you, but you don't know much about the .net framework do you?

    File.delete as mentioned in my code above is System.IO.File.Delete


     


     


     



    The Most complete application MPGH will ever offer - 68%




  13. #9
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Richard, you tend to not read the whole first post



  14. #10
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Yeah Yeah, but a working solution is a working solution regardless, Plus, the (assumed) practical solution would be to bypass the recycling bin altogether, why make a one step process two steps when the outcome is the same?


     


     


     



    The Most complete application MPGH will ever offer - 68%