BP Forums
How to delete all files in a specific folder using VB ? - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+---- Thread: How to delete all files in a specific folder using VB ? (/showthread.php?tid=471)



How to delete all files in a specific folder using VB ? - Himansh - 03-12-2012

Hi can Anybody please create an video which tells that "how to delete all files in a specific folder using Visual basic"
because i usually hv to delete files in the folder "prefetch,recent,temp,%temp%" but it becomes very tedious to delete them by entering each folder

please make one video which deals with above problem pls


Re: Please help me! - Vinwarez - 03-12-2012

Hello, Himansh.

I would like to help you, but I do not understand what do you mean.

Regards,
Vinwarez.


Re: Please help me! - Himansh - 03-13-2012

@Vinwarez
hey i mean that i usually delete all files from prefetch,temp
and other folders but it becomes very tedious to go in each folder and delete all the files
can you make a video on vb which tells that how to make a software that automatically delete all files present in a specific folder we want


Re: Please help me! - Vinwarez - 03-13-2012

I know how to make a button which will navigate to specific folders, but I do not know how to make a specific folder to delete itself by a code. I will try to research that. Meanwhile, maybe Brandonio knows and will respond.

Regards,
Vinwarez.


Re: Please help me! - brandonio21 - 03-13-2012

I believe that you are looking for something like this:
Code:
Dim DirectoryInfo As New System.IO.DirectoryInfo(Environment.SpecialFolder.Cookies)
        Dim FileInfo() As System.IO.FileInfo = DirectoryInfo.GetFiles("*", IO.SearchOption.AllDirectories)
        For Each f In FileInfo
            My.Computer.FileSystem.DeleteFile(f.FullName)
        Next

Please note that this deletes cookies from Internet Explorer