views:

35

answers:

1

I want to get content of all files from ftp with FTPWebRequet in C# Windows Application. But i ma searching for best way to do it.

For example i am looking for a file as

tmpReq = (FtpWebRequest)FtpWebRequest.Create("ftp://" + Settings.Default.IP + "/953077/Inserted/XMLComp" + CryptoHelper.Decrypt(Settings.Default.RegCode) + ".xml");

but how i can do it for multiple files

in loop i can create FtpWebRequest and change the fileName XMLComp95202. But i think it's not the best way to do it with this way

A: 

I'm assuming you don't know the name of the files you want on the FTP server- correct? If not you'll have to get a directory of files and loop over the results. Check out WebRequestMethods.FTP."methods"

bigtang
no i know the names of file. for sample XMLComp" + CryptoHelper.Decrypt(Settings.Default.RegCode) + ".xml is equal to XMLComp952025.xml or XMLComp952026.xml
AEMLoviji
in loop i can create FtpWebRequest and change the fileName XMLComp95202<i(it become from loop)>. But i think it's not the bes way to do it with this way
AEMLoviji
Ah - well if you are using MS FTP utility I don't think they enhanced the basic protocol too much - You can check out other implementations (such as Dart) that provide multi file gets
bigtang