Results 1 to 3 of 3

Thread: Comparing file names

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Location
    Phoenix, AZ
    Posts
    22

    Comparing file names

    I know how to bring up the contents of a folder and, I know how to fill a listbox by using a SQL statement. I don't know how to combine the two.

    Here's the challenge. I'm trying to read file names from a listbox (which were filled after reading from a SQL field) and compare each one of them with entries from a file folder using the GetFiles object. The objective is to fill the listbox w/ file names that exist only in the folder and weed out the names that match in the SQL table. Ideas, anyone?
    "Ignorance and prejudice and fear walk hand in hand" - 'Witch Hunt', by Rush

  2. #2
    Junior Member
    Join Date
    Nov 2002
    Location
    Left past the postbox
    Posts
    30

    Reply

    Why not just do a nested loop?

    some psuedo code (or how ever its spelt)

    Code:
    for i = 0  to sqlfilename in the sql field
    
        for x  = 0 to dirfilename in directory
    
              if sqlfilename(i) = dirfilename(x) then
                    
                    ListBox1.Items.Add(sqlfilename(i))
     
              end if
    
        next 
    
    next
    Never hit a man with glasses, hit him with a baseball bat instead.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2003
    Location
    Phoenix, AZ
    Posts
    22
    I did that, in a way. The problem was the program was writing each file name multiple times. I don't think I did it exactly the way you prescribed it, so I'll try it again to see if things turn out differently.

    Oh, for future reference its 'pseudocode'.
    Last edited by joethecool1; Feb 24th, 2003 at 11:46 AM.
    "Ignorance and prejudice and fear walk hand in hand" - 'Witch Hunt', by Rush

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width