Split problem when base name includes extra periods

Bug reports concerning HxD.
Post Reply
happycat
Posts: 4
Joined: 20 Mar 2023 02:08

Split problem when base name includes extra periods

Post by happycat »

"File Tools - Split..." doesn't work right when the base name that is entered for the partial files includes any extra periods such as in "C:\_tmp\test-win64-v0.0_split.zip".
It tries to write out the partial files all with the same wrong name, and gives a message like this:
Overwrite the file "C:\_tmp\test-win64-v0.zip" ?

An easy workaround is to remove the extra periods.
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Split problem when base name includes extra periods

Post by Maël »

The extra periods are indeed the reason, but not as one would assume. While processing the filename it correctly identifies the file extension (last .) and removes it. The adds the number.
But when readding the original file extension, using a ChangeFileExt function, it will not work properly (eventhough the ChangeFileExt itself is correct). For filenames without file extension it will simply add the original one (as expected). For filenames with two dots, after removing the first file extension the remaining name looks like it has a file extension, still, so it will replace that with the original file extension, which causes the error.

So for example for a basename "test-win64-v0.0_split.zip" the intermediary results should look like this (each line shows the result of processing its predecessor line):

Code: Select all

test-win64-v0.0_split.zip
test-win64-v0.0_split
test-win64-v0.0_split01
test-win64-v0.0_split01.zip
However the last step really is like this:

Code: Select all

test-win64-v0.0_split01
test-win64-v0.zip
This error happens because ChangeFileExt identified ".0_split01" as file extension and replaces it with ".zip".

The correct solution is to not use ChangeFileExt for this last step, and simply append the original file extension to get the desired result.

Fixed in dev version.

To be sure I didn't miss another issue, what is the original file name (not the base name) of the file you wanted to split up?
happycat
Posts: 4
Joined: 20 Mar 2023 02:08

Re: Split problem when base name includes extra periods

Post by happycat »

I can no longer remember the original file I was trying to split when I first noticed the problem. (Strangely, the files I do remember splitting recently don't have extra periods in their names.)

However, one of the examples I tested and recreated the problem on was this:
File to split: C:\_tmp\test-win64-v0.0.8.zip
Base name for partial files (incl. path): C:\_tmp\test-win64-v0.0.8_split.zip
Number consecutively

My habit is to take the original filename, whatever it is, and append "_split" before the extension as the base name.

Thank you for fixing this. The work-around is easy enough to do, but it did initially take me a little while to figure the problem out and how to deal with it. So fixing it may help other users, or my forgetful future self. :-)
happycat
Posts: 4
Joined: 20 Mar 2023 02:08

Re: Split problem when base name includes extra periods

Post by happycat »

Do you still take donations? I noticed your Donate button is redirecting to a generic PayPal page:
https://www.paypal.com/fundraiser/hub
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Split problem when base name includes extra periods

Post by Maël »

Thanks for pointing it out. PayPal seems to mess up those links regularly. I'll look into it.

Edit (25.3.2023): seems PayPal itself fixed the issue.
Post Reply