[CentOS] tar and gunzip help

Les Mikesell lesmikesell at gmail.com
Fri Aug 21 20:23:39 UTC 2009


ML wrote:
> HI All,
> 
> I have a directory tree that when the user un-gzips/untars it does  
> into /opt by default.
> 
> The directory tree is like:
> 
> ugui
> |
> |-- <misc files>
> |-- source
> |-----framework
> |------ <misc files>
> 
> so when unzipped I want to end it with /opt/ugui and all the stuff  
> below it.

Gnutar will default to removing a leading / even if you include it in 
the archive paths unless you use the -P option during both the archive 
creation and extraction.

> How do I do this? Can I also issue one command that will unzip and  
> untar the archive at the same time? (I know I can, I just cant get it  
> right)

The -z option will gzip during creation and ungzip during extraction.
However, this operation really sounds like something that should be done 
by building an RPM for distribution if it is strictly an end user 
package or with one of the revision control packages (subversion, etc.) 
if multiple users will be making changes to be merged.

-- 
   Les Mikesell
     lesmikesell at gmail.com




More information about the CentOS mailing list