I have a directory of files that need to be copied every night as a backup.
I am using 'smbclient' to backup the files to a Linux machine but I am seeing an issue where if a file is locked the entire copy process will abort with a NT_STATUS_SHARING_VIOLATION error.
Is there any way to get smbclient to keep copying the rest of the files in the directory and gracefully skip over the locked files?
1 Answer
Don't use smbclient. Mount the shared drive somewhere using mount.cifs and use rsync to make the backup. Example:
# mount.cifs //server/share /mnt/cifs
# rsync -a /mnt/cifs/directory ~/backupsThis would mount the share to /mnt/cifs and then recursively copy directory to ~/backups/directory.
Read up on the usage of rsync since it is a powerful program and has a few gotchas.