MLUG: Re: [MLUG] Option on GNU tar
Re: [MLUG] Option on GNU tar
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Mon, 12 Jun 2006, McIntosh Jason wrote:

Ok, I'm looking at this, and it's gotta be staring me straight in the face but I can't see it. Trying to use tar to extract a gz package, to update a webapplication - gallery 2. Want to upgrade to a new version (well, would also like to use this same method to upgrade things like wordpress and other packages). Anyways, the problem I'm hitting is that generally tar.gz files are created so that extracting them, puts them in their own new directory. i.e.
tar -xvzf wordpress.tar.gz would extract it into { wordpress/rss.php, wordpress/wp-admin/, wordpress/index.php,....} and I REALLY want to strip that wordpress/ out of that, so it extracts the files into the current directory.


What, if there is one, is the tar option for this?


I'm not sure that I understand the problem. You have the tar file and you just want to dump the contents into the default (current) directory? Or you want to be able to send the tar file to someone else and have it dump into their default directory? For the former, unless a directory named wordpress already exists, I do this:

tar -xvzf wordpress.tar.gz ; mv wordpress/* . ; rmdir wordpress

But if a filename might begin with '.', this will be needed:

tar -xvzf wordpress.tar.gz ; mv wordpress/{,.[^.]}* . ; rmdir wordpress

What's so wrong about that?  ;-)

For the latter, you need to recreate the tar file by going into the wordpress directory and creating the tar file from there.

cd wordpress
tar czf ../wordpress.tar.gz ./{,.[^.]}*

Right?

Mike

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members