Talk about new school... all those double dashes make my head spin!
So here's how I'd do what you outlined:
install -d -oadm a
install -d -ogames a/b
install -d -onews a/b/c
install -d -ouucp a/b/c/d
tar -cvf test.tar a
rm -rf a
tar -xvf test.tar
tree -u a
[r...@zeus ~]# tree -u a
a
`-- [games ] b
`-- [news ] c
`-- [uucp ] d
3 directories, 0 files
I suspect that in the compatibility mode for geezers like me who haven't
fully graduated to the endless double-dash argument scheme, there's an
implied -p (or for you Gnu kids, --preserve-permissions) that sets not
just the permissions of the specified directory, but also the ownership
of the parent directories.
HTH
R
Rubin Bennett
rbTechnologies, LLC
1970 VT Route 14 South
East Montpelier, VT 05651
(802)223-4448
http://thatitguy.com
"Think for yourselves and let others enjoy the privilege to do so too."
Voltaire, Essay on Tolerance
French author, humanist, rationalist, & satirist (1694 - 1778)
-----Original Message-----
From: Anthony Carrico [mailto:[email protected]]
Sent: Wednesday, July 14, 2010 9:41 PM
To: [email protected]
Subject: tar and ownership
# tree -u
.
└── [backup ] a
└── [games ] b
└── [news ] c
└── [uucp ] d
3 directories, 1 file
# tar --create --file test.tar a
# rm -r a
# tar --extract --file test.tar
# tree -u
.
├── [backup ] a
│ └── [games ] b
│ └── [news ] c
│ └── [uucp ] d
└── [root ] test.tar
3 directories, 2 files
# rm -r a
# tar --extract --file test.tar a/b/c/d
# tree -u
.
├── [root ] a
│ └── [root ] b
│ └── [root ] c
│ └── [uucp ] d
└── [root ] test.tar
3 directories, 2 files
I wonder why GNU tar doesn't set the owners when it creates the
directory hierarchy in the second case.
--
Anthony Carrico