How can I keep copying after a "NT_STATUS_SHARING_VIOLATION" error with smbclient?

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 ~/backups

This 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.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like