Split data and keep files from the same subfolder together

Hi,

I have two category folder A and B with different subfolders and files in each. Something like:

A/ 
    A1/
        A11.png
        A12.png
        [...]
        A1n.png
    A2/
        A21.png
        A22.png
        [...]
        A2n.png
    [...]
    An/
       [...]

I want to split the two folders in train and valid keeping all the files in each subfolder either in train or valid. I know I can do it manually but there is any way to do it in fastai2.

Thanks!

You probably should do this manually, splitting the folders instead of the files and storing the result in a csv. Then you can use this csv with fastai to do the splitting easily.

Uhm… Looking around I found this post which presents a package that split files using the structure above but this do not allows to keep all the files from the same subfolders.
Pinging the author, @fitler. There is any way to implement this on split_folders?