locked
Zero length file RRS feed

  • Question

  • User1510859543 posted

    We have a process that reads certain files in a network directory.  We would like to bypass any file of zero length.  Is there a way to do this?

    Below is an example of how we are reading the file.

                Dim f As New FileInfo(PFLPath)
                If f.Exists Then
                    'keep the existing path
                    dbfPath = Left(PFLPath, Len(PFLPath) - 4) & ".dbf"
                Else
                    'file could not be found
                    Exit Sub
                End If
    
                'copy the file with same name and dbf extension
                Microsoft.VisualBasic.FileIO.FileSystem.CopyFile(PFLPath, dbfPath)
                'reference the renamed file
                Dim Filedbf As New FileInfo(dbfPath)
    
                'open the dbf file
                strSQL = "SELECT * FROM " & vEnvFile
                Dim da As New OleDbDataAdapter(strSQL, objConn)
                Dim ds As New DataSet(vEnvFile)
    
                'fill the dataset and read the fields
                da.Fill(ds, vEnvFile)

    Monday, September 17, 2018 4:20 PM

Answers