Tuesday, May 3, 2011

Automation in FTPing and file extraction

Hi,

A third party source daily FTPs a zip file (which contains xml file) in a given folder on my application server. Right now, am manually FTPing the sender, download the zip file and extract xml out of it.

If i need to achieve all this programmatically using C#, how do I go about it? ie.I need to.... 1.FTP the sender 2.Download the file 3.Extract the xml and save it to my folder on app server.

Please help.

Thanks a ton!

From stackoverflow
  • I'm going to get downvoted for not answering your questions but C# is probably overkill for this. You could just get curl for windows which will download the file for you and then use the command line version of link text to unzip it. Would be about 2 lines of bat script.

    cd <some dir>
    curl ftp://some.ftp/somefiles/archive.zip
    7z e archive.zip
    

    3 lines with the cd. If you really want to do it in C# then look at these articles.

  • Check out the FTPWebRequest and FTPWebResponse classes. They should have everything you need.

0 comments:

Post a Comment