All My Brain Where stuff from my brain lands

November 4, 2009

Cleaning up extracted package contents

Filed under: System Administration — Tags: , , — Dennis @ 1:06 pm

I hate it when I download a source archive, uncompress it, and find that instead of creating a package directory, with the contents of the archive, the archive was created with a bunch of files at the root directory. Suppose I have a downloads directory with lots of archives. After I uncompress this new archive, I now have a bunch of archive files and a bunch of project specific files all in the same directory. Yuck.

 > cd downloads
 > tar -xzf latestdownload.tar.gz
 > # yuck, stupid package contents in my downloads directory.

Yeah, Yeah, I know I could have listed the package contents (tar -tzf ..) and found that I needed to create a directory first but I’m lazy. So the mess is there. Now to clean it up:

 > tar -tzf latestdownload.tar.gz | xargs rm -rf

There. Files gone. You can do the same thing with unzip -t for zip archives.

1 Comment »

  1. Thank you! I often find myself in the same lazy situation as you described so this tip will be used many times.

    Comment by Peter Jansson — November 10, 2009 @ 5:21 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

css.php
%d bloggers like this: