I wrote an application that creates a data grid from an excel spreadsheet. One column in the spreadsheet contains a group of unique numbers that make up most of a file name that resides on a file server. The application then goes through the datagrid one row at a time searching for that file on the server by looking for file names that contain those unique numbers. When I wrote the application I tested this with the exact file and folder structure that the end user would be using. I tested using a Windows Server. My application found every file, every time. I did my onsite testing a few weeks ago. The end user's file server is a Mac server. There were about 200 files in the excel file that I used to test and the application found all the files except for 6. I tried with a different excel file with about the same amount of files and the application found all but 10. In both instances the files that were not found were on the server and named correctly. I replicated the exact two tests on a my Windows server and it found all of the files. Has anyone come up against something similar when searching a Mac file server? Is there maybe a better way to go about my file search? Any ideas or suggestions are much appreciated!
P.S.
For testing I created a Sub Routine that creates an Excel file with the names of every file that is searched within the file server. In both cases while testing with the end user the files that were not found with the main application searching from the datagrid were found with this Sub Routine and included in the test excel file.
P.S.
For testing I created a Sub Routine that creates an Excel file with the names of every file that is searched within the file server. In both cases while testing with the end user the files that were not found with the main application searching from the datagrid were found with this Sub Routine and included in the test excel file.
Code:
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim DtSet As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & txtFile.Text & ";Extended Properties=""Excel 8.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text""")
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)
MyCommand.TableMappings.Add("Part", "Qty")
DtSet = New System.Data.DataSet
MyCommand.Fill(DtSet)
DataGridView1.DataSource = DtSet.Tables(0)
MyConnection.Close()
MyConnection.Dispose()
For Each row As DataGridViewRow In DataGridView1.Rows
If Not row.IsNewRow Then
Dim FileName As String = row.Cells(0).Value.ToString 'Saves the FileName
Dim FileQTY As String = row.Cells(1).Value.ToString 'Saves the QTY field
Dim FileNameChk As String = FileName
Try
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(Server, FileIO.SearchOption.SearchAllSubDirectories, FileName & "*.AI") 'Takes FileName and searches a directory and child directories
Next
----------------------
Private Sub FindAllFiles() 'Creates a text file that lists every file in the searched directory and sub directories
Dim Server As String = txtServer.Text
Dim Destination As String = txtFolder.Text + "\"
Dim ContentsFile As String = Destination + "Contents.csv"
Dim objWriter As New System.IO.StreamWriter(ContentsFile)
Try
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(Server, FileIO.SearchOption.SearchAllSubDirectories, "*.*") 'Takes FileName and searches a directory and child directories
objWriter.WriteLine(FoundFile + ", ")
Next
objWriter.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub