How can I exclude all dot files in my home directory as well as those dot files in all sub-directories?
I've tried adding the following expression in my exclude file, but for some reason it does not work:
(^|/)\.[^/]*(/|$)
Also, the following doesn't work either:
.*
.*/**
Please try the following commands with the option
--dry-runfirst to make sure that you get the result you expect.Exclude .dotfiles and .folders from current directory
You can use the option
--rexclude "^\."in order to match files and folders beginning with a.(But it will not match .dotfiles in a sub-directory).Example output from
s3cmd sync --rexclude "^\." ./ s3://bucket_nameThe above command with exclude .dotfiles in your current folder ./ and continue to upload normalFolder/.ignoreFile
Exclude .dotfiles from sub-directories
To exclude dotfiles from a sub-directory you can use
--rexclude "\/\."Example output from
s3cmd sync --rexclude "\/\." ./ s3://bucket_nameSo the answer to your question should be similar to the following command:
Explanation of regular expression anchors used:
Useful Reference:
Regular Expressions Cheat Sheet
s3cmd Sync HowTo