Given a tree structure with files in it, say:
source |-- bar | +-- three.txt |-- baz | +-- four.txt +-- foo |-- one.txt +-- two.txt
If I do
tar czvf dest/archive-1.tgz --listed-incremental dest/archive.snar source/*
That creates a
.tgz file containing all the current files and folders, just what I'd expect:
source/bar/ source/baz/ source/foo/ source/bar/three.txt source/baz/four.txt source/foo/one.txt source/foo/two.txt
If I immediately do:
tar czvf dest/archive-2.tgz --listed-incremental dest/archive.snar source/*
That seems to create
.tgz file containing all the subfolders of the current directory, with no files:
source/bar/ source/baz/ source/foo/
This isn't what I want. On a toy example like this one, it's not so bad, but on a large folder structure it makes it much harder to tell that the .tgz is essentially empty. It's a lot of noise. Ideally,
tar would tell me that there are no updated files and exit with an error code, but even if it made an empty tar, that'd be better (for me, in this case) than an archive with lots of empty folders.
Is there any way to make
tar --listed-incremental behave the way that I would like? I've done a few searches to find solutions, but I haven't found much.
I may end up just stop using
--listed-incremental and doing some work with
find to assemble a file list instead, but that's a lot more work if there's a way to make
--listed-incremental do what I want. Any suggestions?