Jump to content

[Resolvido] Função Listar Ficheiros


Andrepereira9
 Share

Recommended Posts

boa noite a todos

A seguinte função pode ser considerada como virus??

É que o  meu anti-virus, sempre que executo esta função, detecta como virus  👍

    Sub ListFiles(ByVal strRootPath As String, ByVal filePattern As String)
        Try

            Dim FullDir() As String = IO.Directory.GetDirectories(strRootPath)
            For Each Dir As String In FullDir

                Try
                    Dim FullFiles() As String = IO.Directory.GetFiles(Dir, filePattern, IO.SearchOption.AllDirectories)
                    For Each File As String In FullFiles

                        Try

                            ' Mostra qual é o ficheiro
                            Debug.WriteLine(File)

                        Catch ex As Exception
                        End Try
                    Next

                Catch ex As Exception
                End Try
            Next

        Catch ex As Exception
            MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try

    End Sub

A informática chegou para resolver problemas que antes não existiam

Quem ri por último é porque está conectado a 52 Kbs.

Link to comment
Share on other sites

        Dim Directório As New IO.DirectoryInfo("c:\WINDOWS")
        Dim TodosFicheiros As IO.FileInfo() = Directório.GetFiles("*.*")
        Dim Ficheiro As IO.FileInfo
        For Each Ficheiro In TodosFicheiros
        Debug.WriteLine(Ficheiro.Name)
        Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.