Issue sorting multi-part RAR archives

I am using DOpus version 10.1.0.0.4569 and there is a strange bug sorting multi-part rar archive:
-from DOpus default configuration, you need to hide the extension in local drives folder format

-once it is done, DOpus will not sort multi-part archive correctly.

For this test, I just created empty text file that I renamed with rar extension and here is the result:

Do not add another file in this folder because as it will change the result. I mean, look at the top right result, the bug can disappear if I add a text file with such name "test.txt" which is really weird.
And if I leave this text file, the bug will reappear partially when editing the following file name "test2.part1.rar" "and "test2.part2.rar" to "test_2.part1.rar" and "test_2.part2.rar". The underscore seems to change something as the result is different using something else.

And also, is it a normal behavior that DOpus is using part number as extension because that's really annoying, especially when I need to rename using regular expression (what is identified as extension is not what is displayed in the extension column)

You probably want to use a multi-column sort there. Sort by Name, then Ext. So if two things are identical in the Name column, the Ext column will be used to decide which comes first (instead of it being arbitrary).

You can set up multi-column sorting by sorting by the first column, then holding Ctrl when clicking on the second column. You can save that in your folder format, too.

Yes, there is special, intentional handling for .partX.rar files.

It's mainly so that when you push F2, only the main name of the archive is selected, not the .partX part as well.

But the .partX really is part of the file extension and if you remove if the archive becomes invalid. (Multi-part RAR archives have a flag in their headers which specifies whether they use the old .rXX extensions or the new .partX.rar extensions. If you rename the files so that they no longer agree with the flag in the header, many RAR tools will become confused.)

[quote="leo"]You probably want to use a multi-column sort there. Sort by Name, then Ext. So if two things are identical in the Name column, the Ext column will be used to decide which comes first (instead of it being arbitrary).

You can set up multi-column sorting by sorting by the first column, then holding Ctrl when clicking on the second column. You can save that in your folder format, too.[/quote]I tried this solution yesterday before wasting my time and yours and it didn't work...because I was dumb enough forgetting a refresh was not enough to observe the result... :confused:
So, many thanks Leo, it works now...errr, that's crazy the time spent uselessly when the fix was already there

Yes, there is special, intentional handling for .partX.rar files.

It's mainly so that when you push F2, only the main name of the archive is selected, not the .partX part as well.

But the .partX really is part of the file extension and if you remove if the archive becomes invalid. (Multi-part RAR archives have a flag in their headers which specifies whether they use the old .rXX extensions or the new .partX.rar extensions. If you rename the files so that they no longer agree with the flag in the header, many RAR tools will become confused.)[/quote]Ok, that makes sense.
Is there a way now to let DOpus identify the real file extension when renaming using regular expression? Or maybe I need to use something specific like "(.*)(.part\d+.rar)"

I'm not sure what you mean. Could you give an example?

I am using usually such expression -> "b[/b]" to identify file extension in most of my buttons created for the usual renaming task but obviously, it doesn't match the multi-part rar archive. So I need to use something more specific like "b[/b]" for such file. For now, there isn't any problem.

I prefer to hide extension because it makes manual renaming faster as I don't need to pay attention at preserving extension.
So, the extension is displayed in a column and I just need to look at this column when I am searching for a specific file type.

No problem in this case...

Usually, I don't need to care about extension column as I know if there are identical files name, that means they are not using the same extension...

...so I can select my file before renaming them...

...and push the button and...

or

So what I meant before was about a unique way to identify the file extension in multiple case.

Or at least, I could add a new label for multi-part RAR archive that could use a color that inform me these files are different. But I am not sure it is even possible.
I have now such label for archive files:
*.(rar|zip|ace|7z...etc)
I can create this one for multi-part RAR
*.(part#[0-9].rar)

But it will never be displayed because my archive label already matches such files.
I tried to find a way to exclude multi-part RAR from my archive label but it doesn't work in such way:
*.(~(part#[0-9]).rar|zip|ace|7z...etc)

So, I need to deal with this annoying RAR specificity.

If you want different labels for multi-part RAR archives, use these type regular expressions to define the labels:

  • ^(.*)\.part\d+\.rar$
  • ^(?!.*part\d+\.rar$)(.*)\.rar$

The first one matches the *.partX.rar files, while the second one matches all *.rar files except the *.partX.rar ones.


The (?! ) part in the second regexp is the key. It's called a negative assert:

Negative asserts in regexps are a bit fiddly if you haven't used them much (and most people haven't), but they're useful for this kind of thing. Using the ^ (start) and $ (end) anchors is important here, else the negative assert doesn't do very much.

As for the actual renaming, there's probably some way to construct a regexp that will extract the name and extension into different captures, including the partX stuff, but it's much easier to do it a different way.

How best to do that depends on the exact rename you are doing.

If you're using regular expressions, you can do something similar to what I just showed for the labels. An old name of ^(?!.*part\d+\.rar$)(.*)(\.[^.]+)$ will split the name and extension, while avoiding *.partX.rar files entirely. You could then have a second rename which handles the *.partX.rar files specially.

In some cases, a rename script might be easier.

You can also turn on Enable file information fields in the rename dialog (or give FILEINFO on the command line) and then use {ext} in the New Name to insert the extension (with handling of *.partX.rar), although that probably won't help here unless you want to completely replace the rest of the name (since there isn't an easy way to capture the rest of the name).

wow :open_mouth: , I didn't know it was possible!
I was wrong when I decided I will click "later" on the external link from the help file. And everything from this page is working in DOpus?
TR1 Regular Expressions

So many times I was frustrated by the lack of such function....many thanks for that, that's definitely helpful!

For now, I will use a separate label for multi-part RAR, that seems to me the simpler way to deal with them. But the other info you posted will be very useful for other things.

However, I would like to give my opinion/feedback about considering '.partX' as a part of file extension in the column extension.

[quote="leo"]Yes, there is special, intentional handling for .partX.rar files.

It's mainly so that when you push F2, only the main name of the archive is selected, not the .partX part as well.

But the .partX really is part of the file extension and if you remove if the archive becomes invalid. (Multi-part RAR archives have a flag in their headers which specifies whether they use the old .rXX extensions or the new .partX.rar extensions. If you rename the files so that they no longer agree with the flag in the header, many RAR tools will become confused.)[/quote]For me as a user, a multi-part RAR archive is just some RAR files like any other RAR archive, there is nothing special about them.
As you said, if I edit or remove the .partX from the file name, the archive will not work correctly anymore (or will not work at all) but where I disagree with you is, it will be the same if you rename also the base name for just one file:

test.part1.rar+test.part2.rar= works
test.party.rar+test.part2.rar = doesn't work
but
fest.part1.rar+test.part2.rar = doesn't work also

The '.partX' thing just like consistency with the base name are as important. I don't understand the kind of problem DOpus is trying to fix splitting the base name and the '.partX'. These two information should never be separated in my opinion.
You pointed pressing F2 will allow to edit only the main name of the archive which is really smart and "elegant"...but seriously, why would someone like to edit manually a multi-part RAR archive name? I mean, it is needed to rename all the files with exactly the same main name and as a multi-part means at least two files, I don't know who would like to do that manually when mass renaming is so much efficient. It is like trying to solve a problem that doesn't exist. The only reason to do that manually, is when some of the file are not using the right name...but that means the files are already incorrectly named.

Now, do what you want with my opinion as the solution you gave to me is working perfectly so I am happy with that :smiley: