Avoid errors from tar failing to restore directory permissions
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Avoid Errors From Tar Failing To Restore Directory Permissions
01:09 Accepted Answer Score 24
01:21 Thank you
--
Full question
https://superuser.com/questions/699225/a...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #permissions #tar #timestamp #ownership
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Realization
--
Chapters
00:00 Avoid Errors From Tar Failing To Restore Directory Permissions
01:09 Accepted Answer Score 24
01:21 Thank you
--
Full question
https://superuser.com/questions/699225/a...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #permissions #tar #timestamp #ownership
#avk47
ACCEPTED ANSWER
Score 24
This tar
option might be what you're looking for:
--no-overwrite-dir
preserve metadata of existing directories
I tested as follows:
$ mkdir a b a/diffowner
$ sudo mkdir b/diffowner
$ sudo chmod a+w b/diffowner
$ echo foo > a/diffowner/foo
$ tar -C a -cvf test.tar diffowner
diffowner/
diffowner/foo
$ tar -C b --no-overwrite-dir -xvf test.tar diffowner
diffowner/
diffowner/foo
$ echo $?
0