We are using rsync
to copy files from one location to another location on a different host. We want to exclude a directory from the source location so that files from this directory are not copied . The files inside this directory are actually session data and this data were removed once the session completes . So we are excluding this directory.
For this we modified our rsync
to exclude the directory as follows:
rsync -av --exclude '/share/web/moodle/moodledata/sessions/' --rsync-path "sudo rsync" /share/ 172.31.X.X:/share/ &>/home/fsync/rsyncjob/output."$datetime";
But I can see that the directory is not getting excluded as from the log file can see it is trying to copy the log file:
rsync: send_files failed to open "/share/web/moodle/moodledata/sessions/sess_bnktcuvnv965dj4qtv1438o651": Permission denied (13)
rsync: send_files failed to open "/share/web/moodle/moodledata/sessions/sess_d2vvo9ip79jc13qafgq5of50s2": Permission denied (13)
Please suggest fix to exclude the directory