If you want to extract a folder, but you want to exclude one or several folders during the extraction, you can use the
tar -cf archive.tar ./my-folder/ --exclude="my-folder/sub1" --exclude="my-folder/sub3"
With this folder tree :
my-folder/ sub1/ sub2/ sub3/
The result will be :
./archive.tar my-folder/ sub2/
if you want to reproduce, please indicate the source:
linux – File Compression with 'tar' command – Compress and exclude one or multiple folder - CodeDay