Split data test case error

I got the following error, I have checked it couple of times and I’m sure my code run correctly

Details of failed tests for split_data

Failed test case: failed to omit zero-length image. Tested with 6 images (one of zero length).
Expected:
5 files copied,
but got:
2.

Failed test case: incorrect number of training images when using split of 1.0 and a total of 123 images.
Expected:
123,
but got:
62.

Failed test case: incorrect number of (training, validation) images when using a split of 0.5 and 12 images (6 are zero-sized).
Expected:
(3, 3),
but got:
(4, 3).

Bellow is my code, any suggestion?

[snippet removed by mentor]

Please use function parameters instead of global variables as much as possible. With that in mind, look at the split_size variable and make corrections as required.
Posting code in public is likely to get your account suspended. It’s okay to share stacktrace in your post though.

Okay thanks for the reply, sorry I didn’t know previously that sharing code explicitly is prohibited.