Fork me on GitHub

Project Notes


Comparing methods for synchronizing local folders - cp, rsync.


Problem: need to make or update a copy of a folder to another local folder. This may be for deployment purposes or just some disk management.

Recursive Copy

On *nix-type systems, the cp -R makes a recursive copy.


  • simple
  • built-in shell command (no dependencies)


  • does not help making a true mirror (i.e. deletions do not propagate)
  • inefficient - copies everything even if redundant


$ ./
Making a fresh copy of ./original
$ ./
Making a copy of ./original in ./copy

Using rsync

Most *nix-type systems will have an rsync program available (or it can be installed).


  • can do a proper mirror, including propagating deletions
  • efficient - only copies differences


  • may not be natively available
  • a little more unusual - need to read the man page


$ ./
Making a fresh copy of ./original
$ ./
Performing pristine copy of ./original/ to ./copy
building file list ... done
created directory ./copy

sent 512 bytes  received 170 bytes  1364.00 bytes/sec
total size is 32  speedup is 0.05
Adding 3.txt to source and removing 1.txt from dest
And update with sync..
building file list ... done

sent 305 bytes  received 64 bytes  738.00 bytes/sec
total size is 34  speedup is 0.09

Credits and References

About LCK#15 Bash
Project Source on GitHub Return to the Project Catalog

This page is a web-friendly rendering of my project notes shared in the LittleCodingKata GitHub repository.

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.