Results 1 to 13 of 13

Thread: Ftp

  1. #1
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267

    Unanswered: Ftp

    To All--

    I'm looking for some help with FTP. My question is that I need to figure out how to write code to grab the newest file out of a directory. The filename does contain a date timestamp for the file. Something like how to loop through the files in the directory and look at the file names.

    I've attached an FTP class that I'm using but I'm willing to use whatever else is out there. Thanks.

    C
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Look up Dir() and/or the FileSystemObject in the help files
    George
    Home | Blog

  3. #3
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    I looked up FileSysytemObject but nowhere does it talk about how to use it with FTP. How would you use a fso with FTP?

    C

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    The FSO should help you answer this bit
    Quote Originally Posted by canupus
    My question is that I need to figure out how to write code to grab the newest file out of a directory. The filename does contain a date timestamp for the file. Something like how to loop through the files in the directory and look at the file names.
    George
    Home | Blog

  5. #5
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    georgev--

    I know how to use FSO on the local system but how do you use FSO on the ftp server? I don't think it is even possible. The FSO is for the local computer's file system is it not?

    I'm looking at some API stuff now...Wininet.dll. If anyone has any code samples for that it would be greatly appreciated.

    C

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Yes yuo can use the FSO on a windows server, straight from the box too!
    Code:
    Dim FSO
    
    Set FSO = CreateObject("Scripting.FileSystemObject")
    ....
    etc
    George
    Home | Blog

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    And yes, the FSO is for the local computer's file system.
    George
    Home | Blog

  8. #8
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    georgev--

    I think you are not understanding me. I'm trying to connect to the FTP server which means that if I use FSO than I'll be connected to my laptop and not the FTP server. I'm not located on the server...just trying to connect into it.

    C

  9. #9
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I agree... george, can you be more specific about HOW you can use FSO coding to work with files on a remote site via FTP?

    Perhaps the missing pieces are how you can connect the FTP site and how you might reference the objects. I would guess you'd reference the objects using FTP://path/file etc but I have no idea how you could connect to the FTP site to make such syntax work.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If the requirements were clear up front then we wouldn't have this problem. It was not clear until post #8 that this was the situation.

    Why do you wish to run this remotely - why can't you run it on the FTP server?
    George
    Home | Blog

  11. #11
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    georgev--

    Sorry about the confusion. I'm looking to remotely connect to the ftp server, go through a directory's files, and then download the newest file. I can't run any code directly on the FTP server because it's not my server. Files are uploaded by a customer to a FTP server. I just have rights to log into the server.

    I've been having some luck with some API stuff using wininet.dll but if anyone has any other suggestions I would greatly appreciate them. Thanks.

    C

  12. #12
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    http://www.dbforums.com/showpost.php...8&postcount=40

    See the 2008 (bottom example - MenuSystemInMSAccessByEDP2008.zip) - then the Admin Populate form - click Change button on the Admin Populate form to navigate to a network drive (which ends up using a UNC name to navigate to a networked drive). I'm pretty sure the pieces of the code you need are in this example. You just need to export out and tweak it for your needs.

    1. You'll notice when you click the Change button (admin populate form), you can navigate to a network drive (and possibly your ftp server drive).
    2. Once you grab/(populate) all the files from the selected network drive/folder of whatever type you select, it saves all the files to a table.
    3. You can then sort through the files in the table looking for the most recent date (you'll notice on the main form you can change the (Newer than) or (Older than) date field to see files greater/older than a certain date.)

    Again, I'm pretty sure the code you need is there, you just need to export out and tweak and automate the code you need to do what you want to do. (Hold the shift key while opening to get behind the scenes to the code.)
    Last edited by pkstormy; 06-08-08 at 14:46.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  13. #13
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    pkstormy--

    Thanks for the reply but it doesn't seem to work with FTP. I can't find a way to provide the user name and password.

    C

Posting Permissions

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