Question

this is more of a question because I am experimenting with this.

All over the internet I see how you can update a .txt file. Well that is all good and well, but lets say I have a .doxc or even an .exe or even a .dll file.

If we make a minor change to a file, do we really have to replace(overwrite) the whole file?

Is it possible to "update" the file so that we don't use too mush data (over the internet).

What I am trying to achieve is to create a FTP client with a FileSystemWatcher. This will monitor a certain folder on the Computer. If anything changes in this folder (even sub directories) then it uploads, deletes, renames, or changes the file. But at the moment I am wondering if I have, lets say, a 20MB .exe file or whatever, if it is possible to change something in that .exe, instead of just overwriting the whole thing... thus, sparing some cap.

Was it helpful?

Solution

In general, it's possible to update the remote file only partially, but not in your case.

What would work: 1) track the file change using a filesystem filter driver, which gives you information about what parts of the file have been updated. 2) use the protocol which allows partial upload or remote modification of the file (eg. SFTP).

As for your scenario:

Step 1 is not possible with FileSystemWatcher. Step 2 is not possible with FTP protocol which doesn't support modification of file blocks.

OTHER TIPS

Since your are experimenting, I can provide some pointers. But I dont know for sure if the below operations are just updates or replaced newly by the underlysing os calls

  • Have different cases for each file type. Try with a basic types first, a txt file, then a binary file etc.
  • You should have the entire copy of the current file somewhere, sine you "should" compare the old file to know what changes
  • Then when a change is made to the file compare it with the old file e.g) in a text file with 1 MB and the change is only 1 KB you will need to build a format like
    • [Text][Offset][[operation]
    • e.g) [Mrs.Y][40][Delete] then [Mr.X][40][Add]
  • Then your ftp client should be able to implement this format and make changes to the local copy on the client.

No it is not possible to only upload the changes to .exe file.we have to overwrite it.

@Frederik - It would be possible if FTP supports an updating of resource like HTTP's PUT command. Try exploring that angle. Let us know if you find something.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top