1

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?

Flyk
  • 1,549
  • 1
  • 22
  • 28
Atari911
  • 768
  • 5
  • 11

1 Answers1

1

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.

hololeap
  • 1,471