Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

Using rsync to Sync Two Directories

July 27, 2023 — Gregg Szumowski

You can sync two directories using rsync tool. The following command:

$ rsync -a -v --delete sending_directory target_directory;

will copy sending_directory to target_directory creating a directory structure of sending_directory/target_directory. The --delete flag will ensure that any files that were previously in sending_directory/target_directory that are not in sending_directory will be deleted so that the contents of the two directories are the same.

Tags: cli, rsync, backups, motd

Backup Files with Specific File Extension

July 07, 2023 — Gregg Szumowski

Here is how you can use rsync to backup only the .ogg files in the Music directory to the OGG directory:

$ rsync -a --prune-empty-dirs --include='*/' --include='*.ogg' --exclude='*' Music/ OGG/

Tags: cli, rsync, backups, motd