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.

Powered by WordPress

css.php
%d bloggers like this: