Friday, August 2, 2013

to get the list of files from a directory in asp.net

To get the complete list of pdf files under specified directory

Private Sub GetFileList()
        Dim dir As New DirectoryInfo("D:\Sai")
        Dim dirinfo As FileInfo() = dir.GetFiles("*.pdf")
        Dim FileName As FileInfo
        Dim path As String
        If dir.Exists = True Then
            For Each FileName In dirinfo
                path = dir.FullName & "\" & FileName.ToString
               'Do Something
            Next
        End If
    End Sub


No comments:

Post a Comment