ftpwebrequest - How to Download Numerous Files from FTP using C#? -
i need run console application @ scheduled intervals needs download .pgp files ftp site. pgp file in ftp must downloaded. i've found sample code directory listing of ftp , have written here:
ftpwebrequest req = (ftpwebrequest)webrequest.create("ftp://ourftpserver"); req.method = webrequestmethods.ftp.listdirectorydetails; req.credentials = new networkcredential("user", "pass"); ftpwebresponse response = (ftpwebresponse)req.getresponse(); stream responsestream = response.getresponsestream(); streamreader reader = new streamreader(responsestream); console.writeline(reader.readtoend()); console.writeline("directory list complete, status {0}", response.statusdescription); reader.close(); response.close();
what must download files of type .pgp directory listing , save them in local directory on our server?
the ftpwebrequest
, ftpwebresponse
objects designed make single requests (i.e. download single files, etc.)
you're looking ftp client. there isn't 1 in .net framework, there's free one, system.net.ftpclient apparently works quite well.
Comments
Post a Comment