Ubuntu 管理心得

搜尋此網誌

2021年10月27日 星期三

Exclude subdirectories or directories using tar

 Do not add the "/" at the end of the subdirectory which is to be excluded.

For example, the following line will NOT exclude the subdirectory: 

tar --one-file-system --exclude=/home/chiao/.local/share/Trash/  -cvf test_Trash.tar /home/chiao

Instead, it should be like this:

tar --one-file-system --exclude=/home/chiao/.local/share/Trash  -cvf test_Trash.tar /home/chiao

No / at the end of --exclude option.