Skip to main content

How to prepend a directory to files placed in a tar archive? [Resolved]

I want to tar the files foo and bar into a tar archive archive.tar, but I want them to appear, within the archive, as being within a directory, bazdir. Thus when I untar someplace I want bazdir to be created and foo and bar to be created within it.

How can I do that?

This would be the opposite of:

https://stackoverflow.com/questions/939982/how-do-i-tar-a-directory-of-files-and-folders-without-including-the-directory-it
or
create flat tar archive: ignoring all parents when adding folders


Question Credit: einpoklum
Question Reference
Asked October 11, 2017
Posted Under: Unix Linux
12 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA