Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB6 - A simple FTP directory synchronizer

Posted on 2003-11-24
1
Medium Priority
?
500 Views
Last Modified: 2010-04-17
I'm trying to make an ftp app that basically does directory synchronization, but I suck at programming.
I would like to figure out how to take each file name in the remote ftp directoy and compare it to the contents of a local directory and upload only the files that are in the local directory but not on the server. Also Delete any files that are on the server that are Not in the local directory.

I'm thinking perhaps it would be easier to use List Boxes then compare the two or something like that.

Can someone help me out with this please :)

Heres the code I have so far...


[code]
Private Sub cmdConnect_Click()
    Dim BUFFER() As String
    Dim ITEM As Variant
     
    With Inet1
        .URL = "ftp://" & txtIpAddress.Text
        .UserName = txtLogin.Text
        .Password = txtPassword.Text
        .Execute , "DIR"
        While .StillExecuting: DoEvents: Wend
        BUFFER = Split(.GetChunk(1024, icString), vbCrLf)
        For Each ITEM In BUFFER
            If UCase(Right(ITEM, 4)) = ".jpg" Then
'<---Pseudo code because I don't know how to do this

    'LOOK IN "C:\PHOTOS\" AND SEE IF THERE IS A FILE THERE WITH THE SAME NAME
            If THERE IS ONE ALREADY IN "C:\PHOTOS\" WITH THE SAME NAME THEN
                 Skip FILE '<---MOVE TO THE NEXT FILE
                End If
            ElseIf
                IT IS FOUND IN "C:\PHOTOS\" BUT NOT ON THE SERVER THEN
        'writes the name of the file to a listbox
                txtPhotosRemovedFromServer.Text = txtPhotosRemovedFromServer.Text & ITEM
                .Execute , "PUT ITEM" '<---UPLOAD THE FILE
                While .StillExecuting: DoEvents: Wend
                End If
            ElseIf
                If ONE IS FOUND ON THE SERVER THAT IS NOT IN "C:\PHOTOS\" THEN
        'writes the name of the file to a listbox
                txtPhotosUploadedToServer.Text = txtPhotosUploadedToServer.Text & ITEM
                .Execute , "DELETE ITEM" '<---DELETE THE FILE
                While .StillExecuting: DoEvents: Wend
                End If
            End If
'<---End Pseudo code because I don't know how to do this
        Next
    End With
End Sub
[/code]
0
Comment
Question by:Matrix1000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
Dang123 earned 500 total points
ID: 9818821
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Introduction to Processes

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question