Possible Duplicate:
How to de-unzip, de-tar -xvf — de-unarchive in a messy folder?
This is a pretty annoying occurrence. Sometimes, I download an archive (tar.gz, tar.bz2, zip, rar, etc
) and run tar xf [file]
(or similar) in the file's directory. In rare occasions, all the files extract in the current working directory instead of a sub-directory. This can lead to hundreds of files and hundreds of patterns that can't simply be removed using a pattern matching solution.
Is there a way to get the file contents of an archive and then delete all files on that list in the current working directory?