Recursive Unrar with Deletion as it progresses

Posted by Jharwood on Super User See other posts from Super User or by Jharwood
Published on 2012-06-03T20:36:47Z Indexed on 2012/06/03 22:42 UTC
Read the original article Hit count: 223

Filed under:
|

Basically, i have a set of directories that are constantly being filled with .rar's, and i need to be able to extract them in place with automatic deletion of the left over .(rar|rXX) files. How would i go about this?

Note: I can't delete all of them once done, they have to be deleted as the script completes one rar set.

Example Directory Structure:

/
/folder1/
        /file1.rar
        /file1.r00
        /file1.r01
/folder2/
        /sub.folder1/
                    /file2.part001.rar (contains a directory "file2")
                    /file2.part002.rar
                    /file2.part003.rar
        /sub.folder2/
                    /file3.rar
                    /file3.r00
                    /file3.r01

Expected Result:

/
/folder1/
        /file1.ext
/folder2/
        /sub.folder1/
                    /file2/
                          /file2.ext
        /sub.folder2/
                    /file3.ext

© Super User or respective owner

Related posts about bash

Related posts about unrar