I had a lot of trouble when trying to exclude certain files and directories for 
a backup using smb for the transfer method.  I was unable to find solutions in 
this mailing list or the samba mailing list and so I did a bunch of testing 
with smbclient.  I found that for smbclient to properly match it was necessary 
to use '\' for directory separators (not '/') and in addition the last 
separator must be a double backslash ('\\') and in addition to that each 
backslash must be escaped with, of course, a backslash. (quadruple backslash in 

An example:

$Conf{BackupFilesExclude} = {
   '*' => [
     '\\\\Application Data',
     '\\Documents\\\\My Music',

In the above example, the "Application Data" directory is excluded.  To exclude 
"\Documents\My Music", the quadruple backslash is placed before "My Music" and 
not "Documents".  Next the file "debian_install_dvd.iso" in the directory 
"Downloads\big_files" is excluded.  Note again that the last directory 
separator has a quadruple backslash.  The next line excludes the file 
"ntuser.dat.LOG1" in the root directory.  The next line excludes any ".lock" 
file.  Note that the asterisk at the beginning not only matches the first part 
of the filename but also the directory tree.  When matching files it is 
necessary to match the directories as well, which leads to the next line which 
excludes the "Thumbs.db" file found in any directory.  The last line excludes 
any file or directory which begins with '.'.

Note that if you use the BackupPC GUI, the backslashes do not need to be 
escaped.  You can use single and double backslashes instead of double and 

This is how it worked for me using BackupPC 3.1.0 with samba 3.2.5 on Debian 
Lenny backing up a Windows Vista computer.  Since I can't imagine that this is 
how it's supposed to work you may or may not get the same results with 
different versions of samba or Windows or whatever.  But hopefully others are 
able to make use of my own trials and heartache.

Chris Purves

"I can calculate the motion of heavenly bodies, but not the madness of people." 
- Sir Isaac Newton

Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
BackupPC-users mailing list
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to