Delete files inside folder

Asked

Viewed 39 times

-1

Delete files inside folder

Well I was creating a software where it erases the files from the example folder

I created a folder Hi ai when opening another software it keeps sending logs to this folder

So I wanted to create an application where it erases the files inside that folder minus the folder

1 answer

0


   'Caminho da sua pasta 
    Dim pasta As String = "C:\...\Desktop\Nova pasta"

    'Pega todos os arquivos dentro dela 
    For Each arquivo In FileIO.FileSystem.GetFiles(pasta, FileIO.SearchOption.SearchTopLevelOnly)
        'Apaga
        System.IO.File.Delete(arquivo)
    Next
  • Thank you worked out here

  • Mano I am with a doubt put the folder where it deletes only that varies between users so my user and Administrator more on my friend’s computer his user and Zeus as I do to put so that on any pc run and delete the files ?

  • You can use a standard Windows folder like %appdata%: Dim appData As String = Getfolderpath(Specialfolder.Applicationdata)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.