bash - Copy folder recursively, excluding some folders -
I am trying to write a simple bash script that will copy all the contents of a folder that contains the hidden files and folders Other folders, but I want to exclude certain folders. How do I get it?
Use rsync:
rsync - av --exclude = 'Path1 / to / exclude' --exclude = 'path2 / to / exclude' source destination
Note that source
and source / < / Code> is different, a trailing slash means that copy the contents of the
source
in the destination
folder. Without a trailing slash, this means that copy the folder source
to destination
.
Alternatively, if you have many directories (or files) to exclude, you can use - exclude-from = FILE
, where FILE
is the name of a file in which files or directories are not included.
--exclude
can also contain wildcards, such as - exclude = * /. Svn *
Comments
Post a Comment