useful rsync -------------- Copy only the directory structure without copying any files: ----------- # rsync -a -f"+ */" -f"- *" source/ destination/ The two -f arguments mean, respectively, "copy all directories" and then "do not copy anything else". Copy only directories and Python files: # rsync -a -f"+ */" -f"+ *.py" -f"- *" source/ destination/ This is really handy for replicating the general directory structure but only copying a subset of the files. Copy everything but exclude .git directories: # rsync -a -f"- .git/" -f"+ *" source/ destination/ Note ---- i find this the easiest way to copy just a dir structure #rsync -av --exclude '*.*' /dir_to_be_copied/ /target_dir Replicating Directories ------------ rsync -av --delete /Users/csw/share/mount_points/Charles_Drive3/charles/notes/personal/ /Volumes/Charles_imac_01/charles/notes/personal (source) (target) using the exclude parameter ----------- rsync -av --exclude /admin/mail /Volumes/CSW01/charles/notes/cw/ /Volumes/Charles04/charles/notes/cw (note: the exclude pattern is relative to the source directory) rsync -av --exclude "*.wmv" /Volumes/CSW01/charles/notes/cw/ /Volumes/Charles04/charles/notes/cw just copy certain file types --- rsync -av -- include "*.txt" --exclude "*.*" /Volumes/CSW01/charles/notes/cw/ /Volumes/Charles04/charles/notes/cw NOTE: it's important that "include" comes before exclude -using an include list rsync -av --include-from "/Volumes/Charles05/temp/include.txt" --exclude "*.*" /Volumes/CSW01/charles/notes/cw/ /Volumes/Charles04/charles/notes/cw NOTE: the include list is 1 pattern per line Copying (and re-linking) sym-links (default position is not to copy links) ---- rsync -avl /source/ /target copy referent files, not links ------ rsync -av --copy-links /source/ /target Backing up changed files to a different location ----- rsync -avb --delete --backup-dir=/Volumes/CSW_USB_09/Livelink_sync/BANA/service_man_archive/ --suffix=.`date +%m-%d-%y` /Volumes/ll/26254287/ /Volumes/CSW_USB_09/Livelink_sync/BANA/service_man note --- If we are creating the backup folder inside of the destination folder, take the precaution of create exclusion rules to leave the backup folder(s) out of the rsync that is creating backups. For example, rsync --avb --backup-dir=backup --delete --exclude=backup source/ destination/