Download all files in directory - WeOnlyDo Discussion board

Download all files in directory (General questions)

by Patrick Flynn, Monday, December 06, 2004, 12:10 (7291 days ago)

I have just downloaded this component to see if it could do what I though would be a simple task of copying all files in a Directory
without user intervention.

Working in VB i thought that the sample that pretended to do this would be a place to start but unfortunately this code is carefully written to do nothing.

The GetFiles command seemed another promising place to start but this will copy only a blank file with the same filename as in the directory.

I then tried modifying the VB Sample 8 that gets all names of files
and copying these but again I was only able to create blank files
with the same name.

Using the samples I can interactively log onto the site and download files but completely unable to do this automatically.

What am I missing?

Re: Download all files in directory

by wodSupport, Monday, December 06, 2004, 12:17 (7291 days ago) @ Patrick Flynn

Patrick,

GetFiles is what you need. What problems did you have with it? Can you show me how you tried to use it? You would need to set MaxLevel=1 in order to download only that folder (and no subfolders).

If files with zero size are created, are you sure data connection can be opened?

Re: Download all files in directory

by Patrick Flynn, Monday, December 06, 2004, 14:46 (7291 days ago) @ wodSupport

In the connect event I have the following code

Private Sub Ftp1_Connected(ByVal ErrorCode As Long, ByVal ErrorText As String)
If ErrorCode = 0 Then
Ftp1.GetFiles C:Download , cdrbatches , 1
Else
Debug.Print CONNECT ERROR: & ErrorText
End If
End Sub

This code copies 1 of the 2 files in the cdrbatches subdirectory
but the file size is zero.

If how ever I try to copy from the root directory by using

Private Sub Ftp1_Connected(ByVal ErrorCode As Long, ByVal ErrorText As String)
If ErrorCode = 0 Then
Ftp1.GetFiles C:Download , , 1
Else
Debug.Print CONNECT ERROR: & ErrorText
End If
End Sub

the 1 file availiable is copied successfully

Re: Download all files in directory

by wodSupport, Monday, December 06, 2004, 14:49 (7291 days ago) @ Patrick Flynn

Patrick,

wodFtpDLX has a requirement that all supplied paths should be full paths - absolute ones. So, you cannot just specify or cdrbatches for remote path, you must specify something like

/home/joe/cdrbatches

instead. If you don't know your current path, you can read it in RemotePath argument immediately after connecting to the server.

So, can you try to change that and try again?

Re: Download all files in directory

by Patrick Flynn, Monday, December 06, 2004, 14:56 (7291 days ago) @ wodSupport

That was what I was missing. I had tried the full path but without an initial /

Using the full path all files have downloaded correctly

Thanks for the Help

Re: Download all files in directory

by wodSupport, Monday, December 06, 2004, 15:04 (7291 days ago) @ Patrick Flynn

Patrick,

cool, I'm glad it's ok now.