How to delete a file without sending it to recycle bin [vb08

Use this board to post your code snippets - tips and tricks
2 posts Page 1 of 1
Contributors
User avatar
TheET
VIP-Member
VIP-Member
Posts: 105
Joined: Sun Nov 01, 2009 2:41 am

Hi ,

In this tutorial you will know how to DELETE a file without sending the file to the recycle bin .Very quick and easy .
Basically , most people use the "My.computer.filesystem.delete(fie)"
But that code only send the file to the recycle bin. :( That's bad .

------Tutorial Starts---------------

By using KILL command in Visual basic 2008 , you can delete the file without sending it into recycle bin .

As usual , open up "Visual Basic 2008" > "Create a Project" > Paste a button on top of the form .
Double click on the button then paste in this code .
Code: Select all
Kill("c:\....Your file directory")
Debug and the file will not show up in the recycle bin and been permanently deleted .
------Tutorial Ends--------------------------
Isn't that FAST ?
lol , Hope you like it ! Cheers
Lewis
Coding God
Coding God
Posts: 1564
Joined: Sun Dec 20, 2009 2:12 pm

Hello,
I think this isnt the recomended way of doing it but there is another way also
My.Computer.FileSystem.DeleteFile("c://me/me.exe" ,FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
Image
2 posts Page 1 of 1
Return to “Quick Snips”