In this blog you will find ASP.NET 3.5 articles and some code samples. These code samples are created by me and should be working. Thanks for visiting my blog! Happy Dot Netting

Monday, July 14, 2008

Process files on disk from ASP.NET code

This function would provide you an idea about how to process files on disk from ASP.NET code. It is a function which is quering some network location to get the number of files processed today.

Thanks

 

   Protected Function GetTotalTransactionsfromBackupLocation() As Integer

        Dim objShell = CreateObject("Shell.Application")

        Dim objFSO = CreateObject("Scripting.FileSystemObject")

        Dim objItem, objFile

        -- Set network location you would like to poll

        Dim objFolder = objShell.NameSpace("\\servername\location")

        Dim colItems = objFolder.Items

        Dim NumberOfFilesProcessed = 0

        For Each objItem In colItems

            objFile = objFSO.GetFile(objItem.Path)

            If Day(objItem.ModifyDate) = Day(Today()) Then

                NumberOfPDFProcessed = NumberOfPDFProcessed + 1

            End If

        Next

        Return NumberOfFilesProcessed

    End Function

No comments: