How to remove all files generated by an extracted tar archive

Often I use tar files downloaded from the internet, sometimes these files don't include a directory containing all other files and directories, so it's very tedious removing all files generated by the extraction, but I can use the following command to remove all the files generated:

# rm -f `tar ft file.tar`

# rm -f `tar ftz file.tar.gz`

if the tar archives contain also some directories I shall add the r option to the command line:

# rm -rf `tar ft file.tar`

# rm -rf `tar ftz file.tar.gz`

 

 

merry xmas,

gg1

Posted by at December 24, 2009
Filed in category: Bash Tip & Tricks, linux, and tagged with: , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

Statistical data collected by Statpress SEOlution (blogcraft).