I have the following line that is part of a bash script to copy a website but I want to add to it to exclude one directory website.com/_archive. How do I do this?
rsync -a --info=progress2 --no-i-r ~/website.com ~/tmp/"$projectName"/www
The previous line has been functioning. I am just trying to exclude a directory.
You want to use the option
--excludeso your command looks like this:This will also copy the directory
website.cominto the directory~/tmp/"$projectName"/www. If you only want to copy the content without the containing directory, useNote the additional slash after
~/website.comand the changed exclude-option. The exclude-option should contain an anchored path (starting with/) which is relative to the entry point~/website.comor~/website.com/. An exclude option that doesn't start with/, excludes all directories with the given name, no matter where they are in the directory structure.Thanks @jhnc, for pointing that out with your comment.