rsync --exclude not excluding specific files
It turned out that it is the relative path from the folders that are being rsync'd with one another. Not from where you are running the rsync command.
--exclude "generator/" --exclude "server/lib/personas_constants.php" --exclude "server/lib/connect.php"
Fixed my issues.
rsync include specific files and exclude directory
You need to put --exclude='build'
before --include '*/'
. Both of these rules could apply to the "build" directory, and whichever is given first takes precedence, so to get the --exclude
rule to override the --include
rule, you need to list it first.
From the rsync
man page, in the FILTER RULES section (with my emphasis):
As the list of files/directories to transfer is built, rsync checks
each name to be transferred against the list of include/exclude
patterns in turn, and the first matching pattern is acted on: if it is
an exclude pattern, then that file is skipped; if it is an include
pattern then that filename is not skipped; if no matching pattern is
found, then the filename is not skipped.
rsync --exclude and --exclude-from not working
This should exclude Images
folder:
rsync -avz --exclude 'Images' ./Dummy-dir/ ./Dummy-target/
should be relative to the source path without the source path
Make rsync exclude all directories that contain a file with a specific name
rsync does not support this (at least the manpage does not mention anything), but you can do it in two steps:
- run
find
to find the.rsync-exclude
files pipe this list to
--exclude-from
(or use a temporary file)--exclude-from=FILE
This option is related to the --exclude option, but it specifies a FILE that contains exclude patterns
(one per line). Blank lines in the file and lines starting with ';' or '#' are ignored. If FILE is -,
the list will be read from standard input.
alternatively, if you do not mind to put something in the files, you can use:
-F The -F option is a shorthand for adding two --filter rules to your command. The first time it is used
is a shorthand for this rule:
--filter='dir-merge /.rsync-filter'
This tells rsync to look for per-directory .rsync-filter files that have been sprinkled through the
hierarchy and use their rules to filter the files in the transfer. If -F is repeated, it is a short-
hand for this rule:
--filter='exclude .rsync-filter'
This filters out the .rsync-filter files themselves from the transfer.
See the FILTER RULES section for detailed information on how these options work.
rsync: How to apply a recursively include filter while excluding other files
Try first including folders themselves:
rsync -zarv \
--include="/*.html" \
--include="/js/" \
--include="/js/**/" \
--include="/js/**.min.js" \
--include="/js/**.min.js" \
--include="/js/**.min.js.map" \
--include="/css/" \
--include="/css/**/" \
--include="/css/**.min.css" \
--include="/css/**.min.css.map" \
--include="/img/***" \
--exclude="*" \
--delete \
./ "$to"/
Related Topics
How to Change the Language of My Git
How to Install Visual Studio 2015 in Ubuntu
Coqide 8.5: No Syntax Highlighting on Linux
Making 'Long' 4 Bytes in Gcc on a 64-Bit Linux MAChine
How to Capture All the Commands Typed in Unix/Linux by Any User
Intellij Idea 2017.2 Can't Add Openjk 9 on Linux Mint 18
Is There a Subversion Web Client That I Can Use
Communicating Between a Parent and Its Children
Limit Useable Host Resources in Docker Compose Without Swarm
Can't Source Script in a Current Directory
Xargs Sh -C Skipping the First Argument
Split Delimited File into Smaller Files by Column
Errors While Installing Opencv and Ffmpeg Through Rightscripts
Windows Equivalent of ./ (Current Directory)
Bash Script to Run a Constant Number of Jobs in the Background