Spliting folders containing images

Hello, I have a folder containing n number of patient folders. Each patient folder has subfolders as dates and contains two types of subclasses CT and PET. I want to create an image data loader and apply preprocessing and patch extraction and saving them as numpy arrays for the GANS network in a similar data structure.
Is there any simple way to acheive this using pytorch. Such that the data structure is also preserved(since it contains datewise and patientwise dicom images)

patient_01–>db10102014–>CT, PET

         >db11102014-->CT, PET


In the end I want three folders train ,test and valid that will have same subfolders as above
train – patient_01>db_xxxx>CT, PET(each PET,CT will contain patches,instead of raw images)
and so on
Similarly for test and valid folder.

Thank you in advance.