Skip to content

Instantly share code, notes, and snippets.

@fnl
Created January 29, 2013 10:16
Show Gist options
  • Save fnl/4663244 to your computer and use it in GitHub Desktop.
Save fnl/4663244 to your computer and use it in GitHub Desktop.
backup/restore files to [a USB dongle] FAT32 drive on OSX/HFS using rsync. Updates and deletes changed files recursively starting in some root directory "dir". Note that the terminal slashes present in the paths are required for rsync to work correctly.
# backup from HFS drive to FAT32 (NB: file owner and extended metadata are not synced):
time rsync --recursive --update --delete --links --hard-links --safe-links --perms --times --modify-window=1 --stats --exclude '.DS_Store' --exclude '._*' ~/dir/ /Volumes/FAT32
# restore from FAT32 to HFS (NB: "--delete" removes files in "dir" not in "FAT32"):
time rsync --recursive --update --delete --links --hard-links --safe-links --perms --times --modify-window=1 --stats --exclude '.DS_Store' --exclude '.Spotlight-V100' --exclude '.fseventsd' --exclude '.Trashes' /Volumes/FAT32/ ~/dir
@ulfoaf
Copy link

ulfoaf commented Nov 15, 2021

Much appreciated. Syncing from a FAT32 thumb drive to an HFS volume is exactly what I want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment