简体   繁体   English

duplicity --exclude选项不排除提到的目录

[英]duplicity --exclude option doesn't exclude the mentioned dir

#!/bin/bash

datetime="`date +%Y%m%d`";

export AWS_ACCESS_KEY_ID="MYKEY"
export AWS_SECRET_ACCESS_KEY="MYSECRET"
export BACKUP_DEST_FILES="s3://s3.eu-central-1.amazonaws.com/mybucket"

cd /var/www/
dirs=($(find * -maxdepth 0 -type d))
for dir in "${dirs[@]}"; do
cd $dir
subdirs=($(find * -maxdepth 0 -type d))
for subdir in "${subdirs[@]}"; do
duplicity full --exclude "**logs/**" --exclude "**backups/**" --no-encryption $subdir $BACKUP_DEST_FILES/$dir/$datetime/$subdir
done
cd ../
done

This code supposed to backup every directtory and subdirectory under /var/www/ except for "logs" and "backups" dirs. 此代码应该备份/ var / www /下的每个directtory和子目录,但“logs”和“backups”dirs除外。

While it works perfectly with the rsync command below: 虽然它与下面的rsync命令完美配合:

rsync -ar --exclude='backup' --exclude='log' --exclude='logs' --exclude='backups' $subdir backups/$datetime/

..it doesn't work with duplicity command below. ..it不适用于下面的duplicity命令。 It just backs up everything and doesn't exclude. 它只是备份所有内容而不排除。

duplicity full --exclude "**logs/**" --exclude "**backups/**" --no-encryption $subdir $BACKUP_DEST_FILES/$dir/$datetime/$subdir

What am I missing here? 我在这里错过了什么?

OK I excluded the unnecessary directories in subdirs=($(find * -maxdepth 0 ! -path /path/to/exclude -type d)) point. 好的我在subdirs=($(find * -maxdepth 0 ! -path /path/to/exclude -type d))点中排除了不必要的目录。 So the directories are being excluded during the step before duplicity process. 因此在双重处理之前的步骤中排除目录。

Thank you. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM