3

I can't seem to get the aws sync s3 command to exclude directories. I am backing up a mounted filesystem from OpenVZ which is located at /vz/root/100.

My command is:

aws s3 sync /vz/root/100 s3://[mybucket]/vz/root/100 --exclude="proc/*" --exclude="sys/*"

I have tried:

--exclude="proc/"
--exclude="/proc"
--exclude="*/proc/*"
--exclude="/vz/root/100/proc"

No matter what I do, the sync process still recurses through the proc directory. I saw an issue back in 2013 that exclude wasn't working but it is "fixed" according to them.

# aws --version
aws-cli/1.9.5 Python/2.6.6 Linux/2.6.32-042stab111.12 botocore/1.3.5

Any ideas?

Devon
  • 780
  • 1
  • 9
  • 20
  • I don't know what the issue could be, but if there aren't too many subfolders to the `/vz/root/100` directory you could do a workaround by doing the opposite: Exclude everything and include only the subfolders. `--exclude="*" --include="/vz/root/100/sub1" --include="/vz/root/100/sub2"` – Bazze Nov 09 '15 at 11:33
  • @Bazze, I considered doing that. It is through a script, so it's more than just 100. It does work if I use `*proc*` without any slashes, but then it's likely going to ignore a file with proc in the name that could be important. It looks like their exclude functionality is still broken. – Devon Nov 09 '15 at 16:32
  • Per this ServerFault post, it might be a bug in the CLI tools: http://serverfault.com/q/551457/253490 – Castaglia Mar 19 '16 at 16:48

2 Answers2

4

This worked for me: --exclude "*/dirname/*"

Using aws-cli version 1.11.103.

armandino
  • 141
  • 4
1
--exclude "proc/"
--exclude "/proc"
--exclude "*/proc/*"
--exclude "/vz/root/100/proc"

Do not use =. Worked for me

Anton Danilov
  • 4,874
  • 2
  • 11
  • 20
Nafeo Joy
  • 111
  • 2