S
S
Sergey Durov2016-05-24 15:43:02
Zip
Sergey Durov, 2016-05-24 15:43:02

How to archive only a folder, without a path?

There is a command that archives a folder.

tar -P -zcvf folder.tar.gz /tmp/my_folder/other/other2

But the trouble is that the archive is obtained with subfolders and not just the one that I need.
For example, in the example, it turned out that in the other2 archive, the folder is still in 3 parent folders, and I need that after unpacking the archive, only the other2 folder should be there.
ps: I can't just cd into a folder, since it's all done in a python script.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2016-05-24
@jcmvbkbc

tar -P -zcvf folder.tar.gz -C /tmp/my_folder/other/ other2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question