A few days ago I posted a quick update on maxprog site HTML5 upgrade, Updating an old HTML site to HTML5 and CSS3 about how I managed to perform the task quite successfully during the last months. After reading it again today I forgot an important part of the process, file synchronization.
Indeed, each time you touch a file you have to upload it to your web server in order to publish it. Usually, if I modify single files, I will very likely cycle thru uploading, rendering and fixing as many times as needed until I am happy with what I see so I can move on to the next page. This is usually what I do when the pages are mostly finished and at there final 'polishing' stage. For uploading I use a FTP client software. It happens that I am a software developer, specialized in internet protocols, including the FTP protocol and I wrote an FTP Client called FTP Disk. So I use my own software, I can even copy URLs from it and preview them in a browser quite easily. But what if you batch-modify hundreds of files a once? My software has no synchronization feature (yet) and going thru folders and uploading stuff manually is tedious and error-prone. The solution here is RSYNC.
RSYNC is a unix console tool that you use with the macOS terminal. It is a blazing fast and fully reliable file synchronization tool you will really enjoy. So how do you synchronize a directory? Simple, just launch the terminal and write this:
- Replace /path/to/local/folder/ with the local directory you want to synchronize.
- Replace 'user' with your server account ID (same as ssh id).
- Replace 'server' with your server address, the one you would use for ssh.
- Replace path/to/remote/folder/ with the remote directory to synchronize
Guess what the --exclude '.DS_Store' parameter does?... Note that you can add more exclude parameters one after the other or even use wildcards.
About the parameters:
- r: Recursive, recurse into directories
- t: Times, preserve times
- v: Verbose, increase verbosity
- z: Compress, compress file data during the transfer
So RSYNC will compare local and remote files in the selected directory recursively, will create a compressed archive of modified files, transfer it to your server and uncompress it to the right location preserving the time info. All in a breeze!
You will even get the list of transferred files on screen.
IMPORTANT NOTICE: Our office will be closed for holidays from June 6th, 2018 until July 10th, 2018 inclusive, our support may be limited so please expect a delayed response during that period. More information here. Thank you for your patience and understanding.