Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
How to de-unzip, de-tar -xvf — de-unarchive in a messy folder?

I just extracted a RAR archive that contained a lot of files in the base directory. Assuming that there were no filename collisions, what's the easiest way to remove the files just created? Parsing unrar -l seems troublesome due to filename variety.

share|improve this question
add comment

marked as duplicate by Gilles, Tim N, Michael Mrozek Nov 5 '11 at 18:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 2 down vote accepted

Use unrar lb archive.rar to get a list of bare filenames, one per line. As long as none of the filenames contained newlines, this should be trivial to parse:

unrar lb archive.rar | perl -ne 'chomp; -d ? rmdir : unlink'
share|improve this answer
    
Thanks! Didn't know about lb. –  Tim N Nov 5 '11 at 18:34
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.