How to use cp command to exclude a specific directory?

Though there is no –exclude option available in cp command but you can still exclude certain file or directory from being copied.

Example:

Create some files and directories:

Exclude specific directory in cp command:

Exclude specific file in cp command:

Leave a Reply