Unable to exclude directories from s3cmd sync

490 views Asked by At

I'm having an issue excluding directories on a nightly backup script using S3cmd.

I'm trying to exclude certain files from being backed up (log files, etc...)

My server structure is:

/srv/users/USERNAME/
/srv/users/USERNAME2/

etc...

So I'm running an s3cmd on cron, similar to:

s3cmd sync --config=/path/to/config/.s3cfg --delete-removed --exclude-from=/path/to/exclude/backups.exclude /srv/ s3://aws-bucket/

where my backups.exclude file contains:

/srv/users/*/log
/srv/users/*/run

As well as some other similar directories. As should be obvious, I'd like to catch all user directories with that wildcard to exclude them from backup.

However, it doesn't seem to be working. I'm currently running s3cmd version 2 (I upgraded to see if maybe it was a bug).

Thanks!

1

There are 1 answers

0
nocabt On

Ok I figured this out, it was related to the paths. For the sync source, I used /srv (no slash) instead of /srv/ and also updated the excludes file to remove the starting slash, srv/users/*/log/ and added a trailing slash.