Results 1 to 7 of 7

Thread: List all files inside ftp zip?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2013
    Posts
    56

    List all files inside ftp zip?

    Im trying to display in a textbox, all the files inside a zip folder that is located on a ftp server.
    How might I do that?

    This is the code now, which works for the file being on the local machine, how might I modify it to work for "URI's", according to VB.

    Code:
    Public Function checkFilesInFolder(ByVal folderPath As String) As List(Of String)
            Dim fileList As List(Of String) = New List(Of String)()
    
            Try
                ' make a reference to a directory
                Dim di As New IO.DirectoryInfo(folderPath)
                Dim diar1 As IO.FileInfo() = di.GetFiles()
                Dim file As IO.FileInfo
    
                'list the names of all files in the specified directory
                For Each file In diar1
                    RichTextBox1.Text = vbNewLine & file.Name
                    fileList.Add(file.Name)
                Next
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
    
            Return fileList
        End Function
    If I where to put the FTP web address it will tell me it cant work with URI's, and I assume its because "IO" is for local files only, and not remote/server files.

  2. #2
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,398

    Re: List all files inside ftp zip?

    You will need to download the file and extract it. Search the forum there are loads examples. As for unzip use the Ionic.Zip dll.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2013
    Posts
    56

    Re: List all files inside ftp zip?

    There isnt any other way? Because it seems having to download a zip file of a unknown size (for example, larger zip files) then unzipping them to read its contents, display it, then delete the file would take a lengthy time for the program to do all that in (virtually) 1 second.
    Also, my program will list files to download, and before they choose to download the file or not, they can see the contents of that file (which would be a zip), to see if they need/want it or not. Having the program download it anyway to show the content, then delete it, and ask them "Do you want to download this file from the server?" Seems kind of... Weird?

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: List all files inside ftp zip?

    well, that's the way it works...
    What you could do (if it's feasible) is to have a text file that lists the contents of the zip file(s)... then you could jsut grab that (yes, you'll need to download it, but d/l a text file would be far faster than bringing down the zip file) and then list the contents of it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: List all files inside ftp zip?

    Quote Originally Posted by Dibbie View Post
    There isnt any other way?
    Not that I know of. You are up against the ZIP file structure. Its "central directory record" is stored at the end of the file.

  6. #6
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: List all files inside ftp zip?

    Quote Originally Posted by TnTinMN View Post
    Not that I know of. You are up against the ZIP file structure. Its "central directory record" is stored at the end of the file.
    To clarify, you don't need to unzip it, just download it.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  7. #7

    Thread Starter
    Member
    Join Date
    Jul 2013
    Posts
    56

    Re: List all files inside ftp zip?

    Alright, thanks for the replies, ill try it

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