To find out which file to invoke the unrar command is included, you need to determine which file is the first in the file set.
Here are a few examples of file names, of which - naturally - only the first group should be mapped:
yes.rar
yes.part1.rar
yes.part01.rar
yes.part001.rar
no.part2.rar
no.part02.rar
no.part002.rar
no.part011.rar
One (limited) way to do this is with PCRE compatible regular expressions:
.*(?:(?<!part\d\d\d|part\d\d|\d)\.rar|\.part0*1\.rar)
This did not work in Ruby when I tested it with Rejax .
How would you write a single Ruby compatible regular expression to match only the first file in the RAR file set?
Micke source
share