#!/bin/sh # the target drive fileserver="/media/share" # where the files will trasfer from origin="" # where the files will be transfered to dest="" # make sure the file server is mounted if grep -qs "$fileserver" /proc/mounts ; then echo "The drive $fileserver is mounted" else echo "The files cannot sync because filesystem $fileserver is not mounted." exit 1 fi # first sync changes to file server rsync -Prv $HOME/school_files /media/share # then sync back rsync -Prv /media/share/school_files $HOME rsync -Prv $HOME/passwords /media/share/documents rsync -Prv /media/share/documents/passwords $HOME/passwords echo "All done" exit 0