# Mount network drive only if not mounted already if [ ! -d /Volumes/{DRIVE} ]; then mkdir /Volumes/{DRIVE} mount_afp afp://{USER}:{PASS}@{IP}/{DRIVE} /Volumes/{DRIVE} fi # Check if folder needed for syncing is found # If not just skip # Be careful with the --delete param, you can remove if you don't want to delete # You can also use --dry-run to see what would happen before you really use it if [ -d /Volumes/{DRIVE}/{FOLDER} ]; then echo '-- Syncing {DRIVE}/{FOLDER} to {BACKUP_DRIVE}/{FOLDER}' rsync -aruv --delete --exclude='.DS_Store' /Volumes/{DRIVE}/{FOLDER}/* /Volumes/{BACKUP_DRIVE}/{FOLDER}/ fi # # Repeat the above as many times as you need for sync data to backup drive #