Pages

Wednesday, February 2, 2011

Traverse Directory Files and Get Files

Dim
filename, filename2 As FileInfo
Dim myDirectoryInfo As DirectoryInfo
          '----location where the pattern sources are being stored
          myDirectoryInfo = New DirectoryInfo(C:\Duplicates")

Dim myDir As IO.DirectoryInfo

Dim filesInfo() As FileInfo
Dim fileInfo As FileInfo


        Try

            filesInfo = myDirectoryInfo.GetFiles()

            For Each fileInfo In filesInfo
                'Filenames will have the files under a directory
                Filenames = fileInfo.FullName
            Next


        Try
                myDirectoryInfos = myDirectoryInfo.GetDirectories()
                For Each myDir In myDirectoryInfos
                 'del_folder will have the files under a directory
                    del_folder = (myDir.FullName)
         Next


        Catch ex As Exception
          
        End Try

No comments:

Post a Comment