Newsgroup: it.comp.lang.visual-basic
Titolo: Help, Please!

I have created a program that searches on the hard drive in a set location
for txt files, and I kneed it to do this. Search for the txt files on the
hard drive, search for them on the web server (A specific directory), and
then give them the option to download the ones which are on the server and
not on Hard Drive. Can anyone help? Here is the code I am using to search
for the txt files on the Hard Drive (if this helps):
(And I have already tried just changing the location to a server, I does not
work)
Function FindFiles(path As String, SearchStr As String, _
       FileCount As Integer, DirCount As Integer)
      Dim FileName As String   ' Walking filename variable.
      Dim DirName As String    ' SubDirectory Name.
      Dim dirNames() As String ' Buffer for directory name entries.
      Dim nDir As Integer      ' Number of directories in this path.
      Dim i As Integer         ' For-loop counter.
      On Error GoTo sysFileERR
      If Right(path, 1) <> "\" Then path = path & "\"
      ' Search for subdirectories.
      nDir = 0
      ReDim dirNames(nDir)
      DirName = Dir(path, vbDirectory Or vbHidden Or vbArchive Or vbReadOnly
_
Or vbSystem)  ' Even if hidden, and so on.
      Do While Len(DirName) > 0
         ' Ignore the current and encompassing directories.
         If (DirName <> ".") And (DirName <> "..") Then
            ' Check for directory with bitwise comparison.
            If GetAttr(path & DirName) And vbDirectory Then
               dirNames(nDir) = DirName
               DirCount = DirCount + 1
               nDir = nDir + 1
               ReDim Preserve dirNames(nDir)
               'List2.AddItem path & DirName ' Uncomment to list
            End If                           ' directories.
sysFileERRCont:
         End If
         DirName = Dir()  ' Get next subdirectory.
      Loop
      ' Search through this directory and sum file sizes.
      FileName = Dir(path & SearchStr, vbNormal Or vbHidden Or vbSystem _
      Or vbReadOnly Or vbArchive)
      While Len(FileName) <> 0
         FindFiles = FindFiles + FileLen(path & FileName)
         FileCount = FileCount + 1
         ' Load List box
         List2.AddItem path & FileName & vbTab & _
            FileDateTime(path & FileName)   ' Include Modified Date
         FileName = Dir()  ' Get next file.
      Wend
      ' If there are sub-directories..
      If nDir > 0 Then
         ' Recursively walk into them
         For i = 0 To nDir - 1
           FindFiles = FindFiles + FindFiles(path & dirNames(i) & "\", _
            SearchStr, FileCount, DirCount)
         Next i
      End If
AbortFunction:
      Exit Function
sysFileERR:
      If Right(DirName, 4) = ".sys" Then
        Resume sysFileERRCont ' Known issue with pagefile.sys
      Else
        MsgBox "Error: " & Err.Number & " - " & Err.Description, , _
         "Unexpected Error"
        Resume AbortFunction
      End If
      End Function
      Private Sub Command2_Click()
      Dim SearchPath As String, FindStr As String
      Dim FileSize As Long
      Dim NumFiles As Integer, NumDirs As Integer
      Screen.MousePointer = vbHourglass
      List2.Clear
      SearchPath = Text1.Text
      FindStr = Text2.Text
      FileSize = FindFiles(SearchPath, FindStr, NumFiles, NumDirs)
      Text5.Text = NumFiles & " Files found in " & NumDirs + 1 & _
       " Directories"
      Text6.Text = "Size of files found under " & SearchPath & " = " & _
      Format(FileSize, "#,###,###,##0") & " Bytes"
      Screen.MousePointer = vbDefault
      End Sub
   Private Sub Form_Load()
      Command2.Caption = "&Search"
      ' start with some reasonable defaults
      Text1.Text = "D:\Games\Lionhead Studios Ltd\Black &
White\Scripts\Playgrounds\"
      Text2.Text = "*.txt"
   End Sub
TIA
Jon Gullidge
jon.gu...@btinternet.com

Please use a more reasonable subject !
bye, hal

work)
[snip]
You should connect to the web server using http or ftp.
If you decide to use ftp, then look for FtpFindFirstFile Function on msdn.
hth, hal