I am using tar -xf archive.tar -C /home/user/target/folder
(in a bash script) to extract the contents of a specific archive (archive.tar) into the target directory (/home/user/target/folder) so that all existing contents of the target directory will be overwritten by the new ones (contained in the archive).
All works great, but it is one directory in the archive that I would like to omit (from extracting and thus overwriting the existing one in the target folder)... For example, if the archive.tar contains:
folderA/
folderB/
folderC/
folderD/
fileA.php
fileB.php
fileC.xml
How could I extract (and overwrite) all EXCEPT (for example) folderC/ ??
tar --version
outputs tar (GNU tar) 1.23