recursive download a complete remote directory C# - WeOnlyDo Discussion board

recursive download a complete remote directory C# (wodFtpDLX / wodFtpDLX.NET)

by danielR, Friday, April 08, 2005, 14:15 (6956 days ago)

I couldn't manage to download a complete directory recursive from a remote server. The already made postings and hints didn't help.
I'm looking for c# implementation.

Thanks,
Daniel

Re: recursive download a complete remote directory

by wodSupport, Friday, April 08, 2005, 14:29 (6956 days ago) @ danielR

Daniel,

why it didn't work? Idea is this - don't start new download until you complete everything from current dir. So, basically, you should have 2 collections - collection of files to download, and collection of folders to list.

First you get item from folders collection and list it. If there are new folders inside, add them to that collection. As for files in that list, add them to files collection.

Do that as long as there are items in folders collection. Once you empty it - you will have (large?) collection of files to download - and now just download one by one. This time you don't care anymore about changing dir or anything, since you could have store full paths in the collection in the first place.

Does this help?

Re: recursive download a complete remote directory

by danielR, Friday, April 08, 2005, 15:48 (6956 days ago) @ wodSupport

Thanks,

but the thing is how to make the differenc between files and directories. There is no easy way to navigate through the remotedirectory an be sure that one Item is a file and another is a directory?

maybe you can help or already have an example where you implemented the recursive download of an directory?

Daniel

Re: recursive download a complete remote directory

by wodSupport, Friday, April 08, 2005, 16:06 (6956 days ago) @ danielR

Use ListAttributes. It fires AttributesData with info that tells you if item is a dir or a file.

You can reuse code snippet from this thread, just add one more collection for folders.

Re: recursive download a complete remote directory

by wodSupport, Friday, April 08, 2005, 16:07 (6956 days ago) @ wodSupport

I also suggest you download wodSFTP ActiveX. It has one VB sample called 'Do it yourself recursively' with exactly what you need. I think it's fairly easy to convert it to C#

Re: recursive download a complete remote directory

by Shaf, Monday, August 17, 2009, 17:06 (5364 days ago) @ wodSupport

Use ListAttributes. It fires AttributesData with info that tells you if item is a dir or a file.

You can reuse code snippet from this thread, just add one more collection for folders.

The thread no longer exits. Does anybody has that snippet.

Re: recursive download a complete remote directory

by wodDamir, Monday, August 17, 2009, 19:08 (5364 days ago) @ Shaf

Hi Shaf,

What exactly do you need?

I believe GetFiles method should do exactly what you need it to. Can you try it out?

Regards,
Damba

Re: recursive download a complete remote directory

by Shaf, Wednesday, August 26, 2009, 08:52 (5356 days ago) @ wodDamir


What exactly do you need?

Hi Damba,
I need to recursively list all the subdir and files of a given dir. Is there any code snippet already available.
Br,
Shaf

Re: recursive download a complete remote directory

by woddrazen, Wednesday, August 26, 2009, 09:55 (5355 days ago) @ Shaf

Shaf,


You can do that using LoopFiles Method and LoopItem Event. I can show you code snippet.

Can you please just confirme with exactly component are you using and which programming language?


Drazen

Re: recursive download a complete remote directory

by Shaf, Wednesday, August 26, 2009, 14:03 (5355 days ago) @ woddrazen

Drazen,
I am using plain C++ with VS2008 compiler. I did not understand what you meant by component, but I hope this will do.
Shaf

Re: recursive download a complete remote directory

by woddrazen, Wednesday, August 26, 2009, 14:53 (5355 days ago) @ Shaf

Shaf,


It's important that you first check which WeOnlyDo component you are using so we can send you sample for that component.

This is important because we have few components that can handle SFTP connection.

If you didn't yet start developing with our components I would suggest you to try wodSFTP.NET or wodFtpDLX.NET because you are using VS 2008.

wodSFTP.NET supports SFTP protocol only. wodFtpDLX.NET is expensive for 20$ but it supports FTP, FTPS and SFTP protocol.

Let us know for which component you want sample.


Drazen

Re: recursive download a complete remote directory

by Shaf, Wednesday, August 26, 2009, 17:01 (5355 days ago) @ woddrazen

Drazen,
I am using wodSFTP ActiveX Component and COM object. We have a legacy code which use sftpdll.lib and sftpdll.h. The last release note date was:

2.1.1.3 February 18, 2004
* Significant upload speed increase (up to 3 times in some tests)

Thats all I can tell about the component identity at that moment. Is it enought to get the sample ?
Shaf

Re: recursive download a complete remote directory

by wodDamir, Wednesday, August 26, 2009, 17:53 (5355 days ago) @ Shaf

Hi Shaf,

It's no problem to create a sample, but I'm not sure if that sample would even work on your side, since you are using a *really* old version which we don't have anymore.

In one of our later versions, we even implemented a Method (GetFiles/PutFiles) which does exactly this.

Could you please update your version of the component to the latest one?

If you are our licensed user, you can request the latest update from following link: http://www.weonlydo.com/index.asp?update=1

Just make sure you provide the e-mail address registered with us when you purchased the component.

Regards,
Damba