Home Products Downloads News Store Support Forums

Stan's Blog

Stan's Blog

Tips and tricks on how to use Maxprog products

Compatible with MS Windows Compatible with MacOS

 Share this page! 

Using RSYNC to synchronize local and remote directories

Topics
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:

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

Here you have to:

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

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

As a developer I have been considering writing a RSYNC front-end to make thing much more simple. What do you think, should I?


Stan Busk - Software Engineer
at www.maxprog.com





Did you like this post? Share it!


Generic questions
New paragraph
How do I install Maxprog software on my computer?
macOS
MS Windows
New paragraph
How can I change an application language?
macOS
MS Windows
New paragraph
How to register the software I've just purchased?
macOS
MS Windows
New paragraph
How can I recover the serials I have lost of products I purchased here?
macOS
MS Windows
New paragraph
How can I recover my serial from a registered application?
macOS
MS Windows
New paragraph
How can I find out the product name and version my serial unlocks?
macOS
MS Windows
New paragraph
Where can I read your software License Agreement?
macOS
MS Windows
New paragraph
The software doesn't start, runs very slowly or crashes often, how comes?
macOS
MS Windows
New paragraph
Double-clicking on my files no longer opens them with the software, why?
macOS
MS Windows
Stan Busk If you want to make the most of the software that you have acquired at Maxprog, do not miss the Stan's Blog. It is a library of Tutorials and Tips covering specific features and tipical problems you may have when using our tools. This page is updated regularly depending on the topics discussed in our public forums and issues reported thru our HelpDesk. If you are interested on what we are currently working on (or want to participate in beta testings) don't miss the Stan's Logbook.
For years, MAX Programming has provided companies around the globe with sophisticated and innovative solutions. Our commitment to quality is not only evident in our products, but also in our people. It is our mission in Professional Support Services to ensure that our products perform to the fullest of their ability in order to meet the business objectives of our customers. We provide the tools and information required for improved productivity. To accomplish this, we offer an array of services including: Technical Support, Education Services and Consulting Services.

Maxprog is part of an internet site network made of desktoolset.com, emaildesignstudio.com, familycash.com, icash.promo, maxbulkmailer.com, maxprog.com, maxprog.net, maxprog.org, maxprog.us, myrecipients.com, newslettercomposer.com, sharedcontents.com, stanbusk.com, stanbusk.pairserver.com, usertools.com.

 !  WAIT! In order to add a comment below just use your Facebook, Google, Twitter or Disqus login data.

Home Products Downloads News Store Support Forums