Solved

VB6 - A simple FTP directory synchronizer

Posted on 2003-11-24
1
498 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 250 total points
ID: 9818821
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
AutoIncrement column based of FK 11 72
Hive vs Impla in Hadoop 1 149
troubleshoot a python script 8 113
Eclipse neon2 "Java build path" correctness 7 43
This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

734 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