Situation:
Lets mention there is a tar file with a structure like this:
- DIR A
- FILE 1
- DIR B
- FILE 2
- DIR C
- FILE 3
And on my disk there is a directory with a structure like:
- DIR A
- FILE 1
- ... (more files and folders)
- DIR B
- ... (files and folders, but not FILE 2)
Question:
Is there a way to achieve that the unpack command doesn't create new diretories (= directories which are not present in the unpack location shall be skipped/excluded) and that files which are already present won't get replaced?
After unpacking the disk structure should be like:
- DIR A
- FILE 1 (NOT replaced by tar)
- ... (more files and folders)
- DIR B
- FILE 2 (from tar, because it wasn't there before)
- ... (more files and folders, but not FILE 3)
(please note that DIR C should not be created)
Update
I already figured out that '--skip-old-files' achieves that old/existing files will not be replaced at unpacking.
where
$(ls -d /home/bob/*/)
list only directories on your destination, -k preserve existing files