Home Products Downloads News Store Support

Stan's Blog

How to synchronize a website with local files

How to use Maxprog products Maxprog's Blog

Compatible with MS Windows Compatible with MacOS

How to synchronize a website with local files

How to synchronize a website with local files as fast as possible? It turns out that 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!

How to synchronize a website with local files

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 through 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.

Since I am a software developer and I am 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.

What 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.

How to synchronize a website with local files

So how do you synchronize a directory? Simple, just launch the terminal and write this:

rsync -rtvz --exclude '.DS_Store' /path/to/local/folder/ user@server:path/to/remote/folder/

Here you have to:

1.- Replace /path/to/local/folder/ with the local directory you want to synchronize.
2.- Replace 'user' with your server account ID (same as ssh id).
3.- Replace 'server' with your server address, the one you would use for ssh.
4.- 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.

The RSYNC 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 the screen. You can have a full and detailed explanation of the used parameters here.

I recommend you to read the wikipedia rsync page and the man page.

In conclusion, since I am a software developer I have been considering writing an RSYNC front-end to make things much more simple. What do you think, should I?

Stan Busk Stan Busk
February 28, 2020

Recent questions from our users
  Mail rejected as SPAM UPDATED Screenshot
  How do I enter turboSMTP settings into MaxBulk Mailer YouTube Video
  How I can change the old activation key with the new one? YouTube Video
  Why do I get a Delivery Report message after each delivery? YouTube Video
  Setting DKIM on MaxBulk Mailer YouTube Video
  How do I add an Unsubscribe link to my messages
  How to import a Bank statement into iCash YouTube Video
  Is Maxprog software prepared for macOS 11 Big Sur? Screenshot
  How to transfer email lists between MaxBulk Mailer copies Screenshot
  How can I download files with sequential numbers in their name? YouTube Video
  Images are missing in the message preview Screenshot
  How to send an email with a picture in the body YouTube Video
  How can I send to a big list of emails with MaxBulk Mailer YouTube Video
  Mail-merge sender data using tags YouTube Video
  I set up my bulk email message but authentication fails YouTube Video

  [Valid RSS]  Subscribe to Maxprog's Knowledge Base

▾ Last videos, Online events and Q&A Sessions ▾

▾ Last customer reviews ▾

Did you like this post?

🔐 Site secured by Comodo SSL
🟢 UptimeRobot - Site Loaded properly