rsync

Bare minimum needed to do backups:

rsync -azv /source_dir /dest_dir

The flags are:

  • -a: archive mode, which means copying recursively preserving file attributes such as timestamp and owner. This is what allows rsync to be super fast in subsequent executions.
  • -z: compress (I wonder if this option makes any sense when the destination folder is in an external hard drive)
  • -v: verbose.

Will it create a directory in the destination?

Writing the source directory without a trailing slash means copying the source directory as a whole into dest_dir. A directory named /dest_dir/source_dir will exist after executing rsync.

rsync -azv /source_dir /dest_dir

Adding a trailing slash after the source directory changes rsync's behaviour to copying the contents within /source_dir, so the contents of /source_dir and /dest_dir will be the same, but source_dir itself won't be created in the destination.

rsync -azv /source_dir/ /dest_dir