Search code examples
directoryduplicity

Trouble excluding specific folders in a duplicity backup


I am trying to backup my web root using duplicity and am having trouble excluding specific folders.

I want to back up /var/www/ that has manny subfolders containg sites : eg :

/var/www/site1.com, /var/www/site2.com

I want to exclude logs and cache folders that can be annywhere in each sites folder structure.

eg :

/var/www/site1.com/cache, /var/www/site1.com/logs

or :

/var/www/site2.com/app/cache, /var/www/site2.com/app/logs

Cache folders are allways called 'cache' Log folders are allways called 'logs'

The command I am using (that does not work) is :

duplicity --include /var/www/ --exclude cache --exclude logs --exclude "**" / s3+http://domain.com/files/

And I get the following error :

Fatal Error: The file specification
    cache
cannot match any files in the base directory
    /
Useful file specifications begin with the base directory or some
pattern (such as '**') which matches the base directory.

Solution

  • I finally worked it out :

    duplicity --exclude "**cache/**" --exclude "**logs/**" /var/www s3+http://domain.com/files/