none
Replace a file while running it RRS feed

  • Question

  • How can i do it like i want it will download from a ftp server a replace the file with a new one

    i just need a code for replace a file

    Sunday, December 30, 2018 1:24 PM

All replies

  • Hi Noam12498,

    It is easy to delete a file and then upload a new file, you could refer to the link below with examples about how delete and how to upload from FTP.

    Delete

    https://docs.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest?view=netframework-4.7.2

    Upload 

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-upload-files-with-ftp

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Proposed as answer by Stanly Fan Tuesday, January 1, 2019 7:29 AM
    Monday, December 31, 2018 6:50 AM
    Moderator
  • Are you wanting to replace the file that is currently executing?  That takes some extra effort.  Let's say your app is called "program.exe".  The easy way is to:

    1. Fetch the new file and call it "program.new"

    2. After you know the file is intact, rename program.exe to program.old

    3. Rename program new to program.exe

    Then, the next time the program starts, you can delete "program.old."


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, January 2, 2019 10:32 PM
  • ok thanks
    Friday, January 4, 2019 1:41 PM
  • Hi Noam1248,

    Is there any update? do you resolve the issue? if the issue still exists, please feel free let me know.

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 8, 2019 1:40 AM
    Moderator