#81 Exclude directory not working

s3cmd (119)
Simon Hill

I want to sync a directory but exclude a couple of sub-directories. I've tried the following but none seem to work
For example, I want to sync everything in /webroot except for the directory /webroot/admin

s3cmd sync --dry-run --verbose --encoding UTF-8 --exclude "/webroot/admin/" /webroot/*
s3cmd sync --dry-run --verbose --encoding UTF-8 --exclude "/webroot/admin/*" /webroot/*
s3cmd sync --dry-run --verbose --encoding UTF-8 --exclude "/webroot/admin" /webroot


  • Christian S.

    Christian S. - 2011-05-12

    After a lot of testing i found a workaround.
    If you write:
    s3cmd sync --exclude "*webroot/admin/*" /webroot
    it works.

    Its not really a solution, but works for me.

  • Freddy Boisseau

    Freddy Boisseau - 2011-09-06

    After doing a lot of testing, I believe I have discovered the issue. The problem is that the --exclude/--include(-from), when converting the values in the these list to regular expression it does not handle the directory name correctly. What I believe it should be doing is replacing a "./" in the file names in list with a "^".

    This would make "./webroot/admin/" "^webroot\/admin\/.*$", when converted to regular expressions. Until this change is made, using the regular expression and manually converting them, will work. This is what I am doing.

  • Fletcher Tomalty


    This bug took me a while to figure out. Please use the same format as a .gitignore so that "venv" will exclude the whole "venv" directory.

    In the mean time, you can change your directory exclusions to the "venv/*" format, which will work correctly.

  • Martin Schlatter

    Same here. Excluding directories does not work.


Log in to post a comment.