Hi @Jam ,
I think the following should do the trick for you:
from sklearn.model_selection import KFold
import pandas as pd
import os

myData = os.listdir(myrootdirectory) 
kf = KFold(n_splits=5, shuffle=True)

train_index, test_index = next(kf.split(myData), None)
train_data, test_data = myData [train_index], myData [test_index]

If you use pandas dataframes, you can then easily pass the train/test dataframe object to your custom Dataset MyDataset. Dataframes make sampling and shuffling much easier in the training cohort.
Hope this helps!
Edit: A split number of n=5 in KFold corresponds to a split ratio 4:1, a.k.a. 20/80