this is not a duplicate of creating a tar archive without including parent directory
If I do tar -czf archive directory
, directory will be added to the archive. I want to add the files of the folder directory
not the directory itself, how?
please suggest answer that does not involve cd
ing to directory
this is not a duplicate of what its showing:
I have a directory called somedir
with contents as abc
, xyz
:
ls somedir
abc xyz
I want to make archive that will contain files abc
, xyz
, not somedir
folder
Update:
if i use the command tar -C /home/username/dir1/dir2 -cvf temp.tar yourarchive
(which the answer to the question of which my question is called duplicate of)
i get this:
what I wanted is tar czf archive.tar.gz -C yourarchive .
, I get this (which is close enough of what I wanted):
what I wanted was is this (directly files, no folder):
tar czf archive -C directory .
will create anarchive
file containingabc
andxyz
. I am therefore closing this. If I'm missing something, please let me know. – terdon Apr 28 '15 at 13:30tar czf archive -C directory .
i am getting archive that contains a folder.
which has files in it. on the other hand if I open the archive i want to make, i must see directly files and no folder – Alex Jones Apr 28 '15 at 13:56.
is implied, anyway. Can you give an example where there is a difference? – terdon Apr 28 '15 at 14:03