[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

msnews.microsoft.com

6/30/2008 1:21:00 PM

Hi there,
does anyone have any tips for enumerating files on an ftp
folder. I'm using the FtpWebResponse .Net object, but the output seems to
be different for each site that you connect to. Are there any built in
classes for doing this?


4 Answers

Jay

7/1/2008 5:11:00 AM

0

On Jun 30, 6:21 am, "Waldy" <some...@microsoft.com> wrote:
> Hi there,
>               does anyone have any tips for enumerating files on an ftp
> folder.  I'm using the FtpWebResponse .Net object, but the output seems to
> be different for each site that you connect to.  Are there any built in
> classes for doing this?

Waldy,

You're on the right track using FtpWebResponse. Check out this
complete sample on MSDN:

http://msdn.microsoft.com/en-us/librar...(VS.80).aspx

-Jay

msnews.microsoft.com

7/2/2008 10:43:00 AM

0

"Jay Riggs" <jay.s.riggs@gmail.com> wrote in message
news:d0b7e0c8-4f2b-4665-baaa-6948b0a10882@p39g2000prm.googlegroups.com...
You're on the right track using FtpWebResponse. Check out this
complete sample on MSDN:

http://msdn.microsoft.com/en-us/librar...(VS.80).aspx

Hi Jay,
I am aware of that example already. My question is how you do
interpret the results that are returned? My companies server reurns a
string like so:

-rw-rw-rw- 1 user group 30202473 Jun 26 14:16 AFileName.ext

The Microsoft ftp site returns a string like so:

09-28-94 04:03PM 77895 APPS.EXE


Sune Foldager

7/2/2008 10:55:00 AM

0

> My question is how you do
> interpret the results that are returned? My companies server reurns a
> string like so:
>
> -rw-rw-rw- 1 user group 30202473 Jun 26 14:16 AFileName.ext
>
> The Microsoft ftp site returns a string like so:
>
> 09-28-94 04:03PM 77895 APPS.EXE
>

Unfortunately, the FTP standard doesn't specify the format of directory listings.
That said, I bet there are tons of free code on the web that can interpret
the most commonly encountered formats. The two mentioned above are probably
the most common; *nix and Mac OS X will use the unix-like format (the first
one), while Windows of course must be different ;-).

Sincerly,
Sune Foldager.


Jay

7/2/2008 3:37:00 PM

0

On Jul 2, 3:43 am, "Waldy" <some...@microsoft.com> wrote:
> "Jay Riggs" <jay.s.ri...@gmail.com> wrote in message
>
> news:d0b7e0c8-4f2b-4665-baaa-6948b0a10882@p39g2000prm.googlegroups.com...
> You're on the right track using FtpWebResponse.  Check out this
> complete sample on MSDN:
>
> http://msdn.microsoft.com/en-us/librar...(VS.80).aspx
>
> Hi Jay,
>            I am aware of that example already.  My question is how you do
> interpret the results that are returned?  My companies server reurns a
> string like so:
>
> -rw-rw-rw-   1 user     group    30202473 Jun 26 14:16 AFileName.ext
>
> The Microsoft ftp site returns a string like so:
>
> 09-28-94  04:03PM                77895 APPS.EXE


Hi Waldy

I guess I should have run the sample before recommending it! I see a
couple choices for you:

1. You can parse the strings returned by the sample. If they're
fixed width, this would be easy. Otherwise maybe a regex would do the
trick.

2. Like Sune mentioned, you can use existing libraries/code:
Check out this article:
http://www.codeproject.com/KB/IP/FtpC...

It mentions an FtpFileInfo object which includes a filename property.
I've never tried the code posted in the article.

There's an open source FTP component that I used a couple years ago
that will do what you need:
http://www.enterprisedt.com/products/edtftpnet/ove...

It includes documentation and a number of samples.


-Jay