Linux – n FTP or FTP-like client which allows “delta uploads” – i.e. only uploading the parts of a file which have been changed

ftplinuxrsync

I frequently make small changes to fairly large text files via FTP (CSS files for web development) and because my internet connection is terribly slow, it's a very painful process.

Even if I change only one character of the file, I still have to sit and wait for considerable time while the entire file gets re-uploaded to the server.

Is there some way I can edit remotely-hosted files on my local computer and when I save the file, only upload the parts of the file which changed?

Edit: I think I've been unclear about how I'm using my FTP client at the moment. Basically, I open a remote file over SFTP using WinSCP. WinSCP saves it to a tmp folder, launches Sublime Text and I start editing it. When I hit save, WinSCP re-uploads the file automatically. I'm never actually saving the file permanently on my computer – everything's done via WinSCP's temp folder. That's why I'm looking for a solution which can be used in this "hit and run" type manner.


Previous Discussion

I previously posted this question on ServerFault where using something like git was suggested, however as I explained:

With git or a similar versioning tool I'd have to make a commit each
time I save the file, right? Even if that could be done automatically
(i.e. if I had a macro which made Ctrl-S in Sublime Text save file and
execute a git push at the same time), I might make 50 – 100 tiny edits
of a CSS file per hour; surely I'd end up with a spammed-out commit
log? Also the git solution is inflexible as it relies on whatever file
I'm editing being part of a git repo.

The only solution I can think of so far is some kind of hacked-up process using rsync but even then, it's very fiddly:

  1. I download the file(s) I need to my computer (via FTP/rsync/whatever).
  2. I open a file in (e.g.) Sublime Text and start making edits.
  3. A background process is monitoring the folder for file modifications. When I save a file, that process instantly triggers an rsync operation from my computer to the server, transferring the changed parts of the file.

However, I'd need to manually set up or specify the remote file or directory paths or else the local rsync script won't know where to rsync the files so this method is still pretty inflexible. This method wouldn't let me instantly browse to a random file, open it and save it like an FTP client does.

There's also no visible feedback like an upload progress bar with this method.

Best Answer

Vim has a built-in plugin called netrw, which allows Vim to edit remote files. Rsync is one of the protocols it can use:

:e rsync://user@hostname:port/path
:w rsync://user@hostname:port/path

Of course, if you have SSH access to the remote machine, and Vim is installed on it, it may be simpler to just use Vim remotely. Nano, Emacs, and other editors with command line interfaces are also options in that case. Depending on just how bad your connection is, though, this might not be a pleasant option.


That all said,

making hundreds of tiny changes to files which are remotely hosted and which must be edited "live" and "in place"

without a reliable rollback system such as what git can provide is you and your organization just begging for agony when you make the inevitable mistakes which may very well go unnoticed until you've forgotten exactly what you did.

Related Question